我製作了一個自動工作流程,可以將歌曲添加到我的iTunes資料庫,並通過藝術家姓名,專輯名稱和歌曲名稱設置他們的信息。然而,當我導入它們時,軌道是沒有保護的,因此我一直在尋找自動添加藝術品的方法。其中一種方法是使用iTunes「Get Album Artwork」。問題在於,如果它提供了它,它往往不會給出非常好的作品。如何使用AppleScript自動將藝術作品添加到iTunes歌曲?
我決定下載歌曲的作品,我沒有將作品存儲在我的「下載」文件夾中。我傳入我的腳本中的input
是我想作爲藝術作品添加到歌曲中的.jpg文件。問題是,每當我運行這個腳本時,它說它不能將別名文件變成文件類型。錯誤信息如下:
Can’t make alias "Macintosh HD:Users:Nilay:Downloads:Avicii - True - Hey Brother.jpg" into type file.
沒有理由不應該能夠找到該文件,因爲我發現使用Automator的「過濾器Finder項目」,所以我知道這是通過在正確的文件的文件。
我試圖通過文件的文本而不是實際的文件,但仍然導致相同的消息。前幾個評論是我嘗試解決這個錯誤消息的幾種方法,但是,唉,沒有工作。
我想知道如果有人知道如何解決這個錯誤信息或其他方式,我可以添加自定義藝術作品的歌曲,而無需手動去iTunes - >選擇歌曲 - >獲取信息 - >藝術品 - >添加藝術品。如果有人能夠解釋如何使用AppleScript或Workflow自動執行此操作,也是可行的。謝謝!!!
on run {input, parameters}
--set jpegFilename to input
--set jpegFilename to "/path/to/some/artwork.jpg"
--set jpegFile to (POSIX file jpegFilename)
--set jpegFile to (jpegFilename as POSIX file)
--tell application "System Events" to set jpegFile to (input as POSIX file)
set jpegFile to input
tell application "Image Events"
set myImage to open (jpegFile as file)
-- the below line needs HFS syntax pathname, eg: MyComputer:Users:liquidx:
-- save myImage as PICT in (file ":path:to:some:temporary.pict")
save myImage as PICT in (POSIX file jpegFile)
close myImage
end tell
tell application "iTunes"
set myTrack to current track
set artworkCount to count of artwork of myTrack
-- the below line needs HFS syntax pathname, eg: MyComputer:Users:liquidx:
-- set myArt to read (file ":path:to:some:temporary.pict") from 513 as picture
set myArt to read (POSIX file jpegFile) from 513 as picture
if artworkCount > 0 then
set data of artwork (artworkCount + 1) of current track to myArt
else
set data of artwork 1 of current track to myArt
end if
end tell
tell application "Image Events"
-- delete (file ":path:to:some:temporary.pict")
delete (POSIX file jpegFile)
end tell
end run
如你所說的我做了,我仍然收到此錯誤:圖片活動得到了一個錯誤:無法獲取POSIX文件(化名的「Macintosh HD:用戶:Nilay:下載:航空工業第二集團公司 - 真 - 嘿兄弟.JPG「)。 – Nilay
如果你已經有了別名,不要使用POSIX文件轉換。 – vadian