【问题标题】:Script to search and compare 2 itunes libraries (python or applescript)用于搜索和比较 2 个 iTunes 库(python 或 applescript)的脚本
【发布时间】:2013-07-06 01:28:22
【问题描述】:

我有 2 个 iTunes 库。一旧一新。有重复的轨道,所以我想用 Python 编写一个脚本(我假设 XML 可能很有用,或者可能有一个我可以使用的 python 添加)或 Apple 脚本。流程将是:

人类给我你图书馆 A 的位置: 人点和命中OK 人类给我图书馆 B 的位置: 人的点和命中OK

对于B中的每个轨道,查看A中是否存在 如果真实 将评论标签更改为“已在 A 中复制” 如果为假 什么都不做

谁能帮忙?

【问题讨论】:

  • os 模块中有一些工具应该会有所帮助。

标签: python macos applescript itunes


【解决方案1】:

是处理速度和内存问题吗?如果是,那么我建议使用 Python。尽管您可能必须找到第三方模块,但它应该运行得更快。话虽如此,Applescript 将为您提供更简单的解决方案。您可以将有关其中一个库(已加载到 iTunes 中的库)的每个轨道的一些关键信息收集到一个数组中,如下所示:

set the_tracks to {}
tell application "iTunes"
    repeat with t in (tracks of user playlist "Music")
    set end of the_tracks to {name of t, artist of t, album of t, time of t}
    end repeat
end tell

然后,使用另一个 Stack Overflow 问题 (Applescript to launch iTunes with a specific library) 中的方便代码,退出 iTunes 并使用第二个库重新启动它。然后再次遍历轨道,但这一次不是将它们扔进一个数组,而是检查关键信息是否匹配。如果没有,请继续迭代,如果有,只需使用代码:

set comment of t to "Dup already in A"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-05
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-15
    • 1970-01-01
    相关资源
    最近更新 更多