为什么这段代码会导致播放列表为空,我怎样才能将该曲目放入播放列表?
#!/usr/local/bin/macruby
framework 'Cocoa'
framework 'ScriptingBridge'
load_bridge_support_file 'iTunes.bridgesupport'
iTunes = SBApplication.applicationWithBundleIdentifier 'com.apple.iTunes'
userPlaylists = iTunes.sources.objectWithName("Library").userPlaylists
userPlaylists << (ITunesUserPlaylist.alloc.initWithProperties Hash[{"name"=>"something unique"}])
playlist = userPlaylists.objectWithName("something unique")
iTunes.add [userPlaylists.objectWithName("Music").tracks[0]], to:playlist
(如果您知道一种避免在使用前插入播放列表的方法,那也会很有帮助。)