2016-12-15 74 views
1

我試圖從iTunes ID(即:656479918)向播放列表中添加歌曲,如果有幫助,我也有一些來自iTunes搜索API的數據。 如何使用AppleScript將此曲目添加到iTunes中的現有播放列表中?從Apple ID的ID中添加曲目到iTunes播放列表

{ 
    wrapperType: 'track', 
    kind: 'song', 
    artistId: 1249595, 
    collectionId: 656479857, 
    trackId: 656479918, 
    artistName: 'The Rolling Stones', 
    collectionName: 'Let It Bleed', 
    trackName: 'Monkey Man', 
    collectionCensoredName: 'Let It Bleed', 
    trackCensoredName: 'Monkey Man', 
    artistViewUrl: 'https://itunes.apple.com/us/artist/the-rolling-stones/id1249595?uo=4', 
    collectionViewUrl: 'https://itunes.apple.com/us/album/monkey-man/id656479857?i=656479918&uo=4', 
    trackViewUrl: 'https://itunes.apple.com/us/album/monkey-man/id656479857?i=656479918&uo=4', 
    previewUrl: 'http://a749.phobos.apple.com/us/r30/Music6/v4/0d/f1/99/0df1995a-02d6-d67c-7d67-1817008e43d7/mzaf_5915143712191719844.plus.aac.p.m4a', 
    artworkUrl30: 'http://is4.mzstatic.com/image/thumb/Music2/v4/76/e2/45/76e245d4-37dc-3597-8f89-75d6bc384923/source/30x30bb.jpg', 
    artworkUrl60: 'http://is4.mzstatic.com/image/thumb/Music2/v4/76/e2/45/76e245d4-37dc-3597-8f89-75d6bc384923/source/60x60bb.jpg', 
    artworkUrl100: 'http://is4.mzstatic.com/image/thumb/Music2/v4/76/e2/45/76e245d4-37dc-3597-8f89-75d6bc384923/source/100x100bb.jpg', 
    collectionPrice: 9.99, 
    trackPrice: 1.29, 
    releaseDate: '2013-01-01T08:00:00Z', 
    collectionExplicitness: 'notExplicit', 
    trackExplicitness: 'notExplicit', 
    discCount: 1, 
    discNumber: 1, 
    trackCount: 9, 
    trackNumber: 8, 
    trackTimeMillis: 251825, 
    country: 'USA', 
    currency: 'USD', 
    primaryGenreName: 'Rock', 
    isStreamable: true 
} 

回答

0

如果你的軌跡是可變的TR(類=軌),那麼你就可以添加和播放列表「myList中」刪除如下:

-- move track to playlist: 
Tell application "iTunes" to duplicate TR to playlist "myList" 

-- remove track from playlist: 
Tell application "iTunes" to delete TR of user playlist "myList" 

請記住,iTunes是異步的:對實例刪除命令可能不會立即執行,但一段時間後。

+0

謝謝,但是如何從iTunes ID或URL初始化曲目? – SuperSkunk

+0

您定義軌道的方式取決於軌道的位置:哪個播放列表,哪個來源。例如:「將myTrack設置爲ID爲zzzz的源ID爲yy的用戶播放列表ID xxxx的每個文件軌道」將創建ID爲zzzz的1項目的列表(如果播放列表的ID是來自源的xxxx)。 – pbell

相關問題