« [eyeD3] eyeD3インストール | トップページ | [reverseObjectEnumerator]逆順に並び替え »

[eyeD3]MP3にジャケットイメージを付与する

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application
property refNSString : a reference to refMe's NSString
property refNSURL : a reference to refMe's NSURL
set objFileManager to refMe's NSFileManager's defaultManager()


###eyeD3へのパス
set strBinPath to (do shell script "echo $HOME/Library/Python/3.9/bin/eyeD3") as text

#####ファイル選択ダイアログ
tell application "Finder"
##set aliasDefaultLocation to container of (path to me) as alias
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell
set listChooseFileUTI to {"public.mp3", "com.apple.m4a-audio"}
set strPromptText to "音楽ファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and multiple selections allowed without showing package contents)

#####ファイル選択ダイアログ
set listChooseFileUTI to {"public.image"}
set strPromptText to "イメージファイルを選んでください" as text
set aliasImagesFile to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as alias
set strImagesFile to POSIX path of aliasImagesFile as text

#####本処理
repeat with objAliasFilePath in listAliasFilePath
set strFilePath to POSIX path of objAliasFilePath as text
###コマンド整形
set strCommandText to "\"" & strBinPath & "\" --add-image=\"" & strImagesFile & "\":FRONT_COVER \"" & strFilePath & "\"" as text
###実行
do shell script strCommandText
end repeat

|

« [eyeD3] eyeD3インストール | トップページ | [reverseObjectEnumerator]逆順に並び替え »

AppleScript Python」カテゴリの記事

AppleScript Music」カテゴリの記事