AppleScriptでiTunesのビデオにアートワークを付ける時に嵌った箇所
追記(2016.05.23)
iTunes 12.4からdescription of artwork 1 of the_track
がmissing valueを返すようになったようです
なので
set artwork_description to description of artwork 1 of the_track if artwork_description is missing value then ... end if
となります missing valueはnillのようなものです
追記終わり
既に設定しているファイルをスキップする
既にアートワークを設定したファイルをスキップしたい時に音楽ファイルの場合は
if exists data of artwork1 of theTrack is false
や
if data of artwork1 of theTrack is not ""
とすれば設定されていないことが分かる
だたビデオファイルの場合はビデオの中から自動的にサムネイルを作成してアートワークに設定してくれている様だった(違うかもしれない)
artworkの設定個数 | scriptで出力されるファイル |
---|---|
0 artwork | サムネイル |
1 artwork | artwork1 |
2 artwork | artwork1 / artwork2 |
アートワークの説明を使う
そこでスクリプトでアートワークを設定する際にアートワークに説明(text)に任意のキーワードを設定して次にスクリプトを実行した時、説明にキーワードが設定されていたらスキップするようにした
set theDescription to description of artwork 1 of theTrack if theDescription is "" then --アートワークの説明が設定されていない end if
こうすることで1度このスクリプトで設定されたファイルはスキップできる