首页 > 解决方案 > 用于刷新单个 iTunes 播客的 Applescript 代码

问题描述

我更喜欢在我控制的时间刷新我的 iTunes 播客,所以通常我右键单击要刷新的播客,然后选择刷新播客。但有时我会错误地选择另一个菜单项,那就是真正的 PITA。所以我想要一个只会刷新一个播客的applescript。我计划将播客硬编码到脚本中——我几乎每天都会做一个,其他的可以在我喜欢的时候通过右键单击来完成。如果我把它们搞砸了,它就不像是主要的 PITA。

iTunes 词典有updatePodcast并且updateAllPodcasts——显然前者是我需要使用的词典(我不想每次都更新它们)。但我不知道如何指定播客!字典没有podcast类或类似的东西,也item没有提供明显的指导。

我试过了:

tell application "iTunes"
    updatePodcast NameOfPodcast
end tell

WhereNameOfPodcast替换为 iTunes 播客列表中的确切字符串 (AFAIK)。Applescript 告诉我:

error "iTunes got an error: NameOfPodcast doesn’t understand the “updatePodcast” message." number -1708 from NameOfPodcast

有谁知道如何让 iTunes从 AppleScript中刷新单个播客?

编辑: 感谢@user3439894 和@wp78de,但引用曲目不起作用。AS 抱怨该轨道不理解该updatePodcast消息。如果我尝试获取专辑列表(every album of playlist "Podcasts" whose name is album_name),我会被告知这album是一个属性,而它需要一个类名。

标签: applescriptitunes

解决方案


试试这样:

tell application "iTunes"
    set allTracks to every track of playlist "Podcasts" whose album is "podcast_name"
    repeat with singleTrack in allTracks
        updatePodcast singleTrack
    end repeat
end tell

或者试试

tell application "iTunes"
    updatePodcast (first track of playlist "Podcasts" whose album is "XY Podcast")
end tell

推荐阅读