如何使用 AppleScript 从我的资料库中删除 Apple Music 曲目?
How can I delete Apple Music tracks from my Library using AppleScript?
我的 Apple Music 资料库太大了。我想通过删除一大堆我从未听过的曲目来清除它。我已经对播放列表成功地做了同样的事情,但我的脚本无法删除曲目:
tell application "Music"
activate
set mytracks_list to (get the id of (every track whose loved is false and played count is 0 and rating is less than 60))
repeat with mytrack_id in mytracks_list
delete (the track whose id is mytrack_id)
end repeat
end tell
mytracks_list
填充没有问题。我收到的错误消息是:
错误“无法获取 id = {130098 的第 1 项,[................] }
我是不是做错了什么,它能正常工作吗?
P.S。这对我的播放列表有效:
tell application "Music"
activate
set myplaylists_to_delete to (get the name of every playlist whose name does not contain "Adrian" and name does not contain "Loved" and name does not contain "Shazam" and name does not contain "Library" and name is not "Music" and name does not contain "Recent" and name does not contain "5 Stars" and name does not contain "Duo")
repeat with myplaylist in myplaylists_to_delete
delete playlist myplaylist
end repeat
end tell
你试过了吗:
tell app "Music"
delete every track whose loved is false and played count is 0 and rating is less than 60
end tell
设计良好、实现良好的“AppleScriptable”应用程序通常可以将命令应用于多个对象;您不需要自己迭代对象。(提示:Apple 事件 IPC = RPC +查询,不是 OOP。)
我的 Apple Music 资料库太大了。我想通过删除一大堆我从未听过的曲目来清除它。我已经对播放列表成功地做了同样的事情,但我的脚本无法删除曲目:
tell application "Music"
activate
set mytracks_list to (get the id of (every track whose loved is false and played count is 0 and rating is less than 60))
repeat with mytrack_id in mytracks_list
delete (the track whose id is mytrack_id)
end repeat
end tell
mytracks_list
填充没有问题。我收到的错误消息是:
错误“无法获取 id = {130098 的第 1 项,[................] }
我是不是做错了什么,它能正常工作吗?
P.S。这对我的播放列表有效:
tell application "Music"
activate
set myplaylists_to_delete to (get the name of every playlist whose name does not contain "Adrian" and name does not contain "Loved" and name does not contain "Shazam" and name does not contain "Library" and name is not "Music" and name does not contain "Recent" and name does not contain "5 Stars" and name does not contain "Duo")
repeat with myplaylist in myplaylists_to_delete
delete playlist myplaylist
end repeat
end tell
你试过了吗:
tell app "Music"
delete every track whose loved is false and played count is 0 and rating is less than 60
end tell
设计良好、实现良好的“AppleScriptable”应用程序通常可以将命令应用于多个对象;您不需要自己迭代对象。(提示:Apple 事件 IPC = RPC +查询,不是 OOP。)