从Applescript中获取当前曲目的艺术作品

从Applescript中获取当前曲目的艺术作品,第1张

概述我正在尝试制作一个脚本来拉出当前播放曲目的图稿并将其写入文件.我已经检查了一些指南,但它们似乎都不起作用,任何提示? tell application "iTunes"write artwork 1 to "path:to:desktop" of type("JPEG")end tell 说实话,我不知道我在做什么.谁觉得有帮助? 谢谢 您可以将当前轨道的图稿1的原始数据写入文件: -- ge 我正在尝试制作一个脚本来拉出当前播放曲目的图稿并将其写入文件.我已经检查了一些指南,但它们似乎都不起作用,任何提示?

tell application "iTunes"write artwork 1 to "path:to:desktop" of type("JPEG")end tell

说实话,我不知道我在做什么.谁觉得有帮助?

谢谢

解决方法 您可以将当前轨道的图稿1的原始数据写入文件:

-- get the raw bytes of the artwork into a vartell application "iTunes" to tell artwork 1 of current track    set srcBytes to raw data    -- figure out the proper file extension    if format is «class PNG » then        set ext to ".png"    else        set ext to ".jpg"    end ifend tell-- get the filename to ~/Desktop/cover.extset filename to (((path to desktop) as text) & "cover" & ext)-- write to fileset outfile to open for access file filename with write permission-- truncate the fileset eof outfile to 0-- write the image bytes to the filewrite srcBytes to outfileclose access outfile

您也可以使用http://dougscripts.com/itunes/scripts/ss.php?sp=savealbumart,但它不包含源代码.

总结

以上是内存溢出为你收集整理的从Applescript中获取当前曲目的艺术作品全部内容,希望文章能够帮你解决从Applescript中获取当前曲目的艺术作品所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1056760.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存