编写一个脚本来帮助我保持我的播放列表在计算机之间同步。
我想我会通过applescript来做。
前半部分是导出到 m3u,这是我遇到的问题。
代码是:
property delimiter_character : " - "
tell application "iTunes"
set this_playlist to playlist "Alternative Mixtape"
set this_name to (the name of this_playlist) as string
set the playlist_count to the count of tracks of this_playlist
set playlist_data to {}
tell this_playlist
repeat with i from 1 to the count of tracks
tell track i
set the end of the playlist_data to {name, delimiter_character, artist, return, location, return}
end tell
end repeat
end tell
end tell
set FileName to "Path:To:File.m3u"
set theFile to open for access FileName with write permission
write playlist_data to theFile
close access theFile
问题是我得到各种“乱码”输出:
listlistutxt Hips Of The Yearutxt - utxtMistutxt
alisvvHDD…ÏXËH+Ï›Hips Of The Year.mp3χ»g∏mMp3 hookˇˇˇˇ Bye Bye…Ï<»»gúMϛϋ’.HDD:Music:Mist:Bye Bye:Hips Of The Year.mp3*Hips Of The Year.mp3HDD(/Music/Mist/Bye Bye/Hips Of The Year.mp3
我尝试将剪贴板转换为纯文本,但在尝试复制为 UTF8 类或记录时不断出现错误。