[Music]Musicアプリの設定を初期化する
注意
音楽ファイルの入ったフォルダはデスクトップに移動されます。
実行後に電源OFF-ONでリセット完了です
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSMusicDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidMusicDirPathURL to ocidURLsArray's firstObject()
set ocidMusicContentsDirPathURL to ocidMusicDirPathURL's URLByAppendingPathComponent:("Music")
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set ocidBackupDirPathURL to ocidDesktopDirPathURL's URLByAppendingPathComponent:("Music.backup")
set listDone to appFileManager's moveItemAtURL:(ocidMusicContentsDirPathURL) toURL:(ocidBackupDirPathURL) |error|:(reference)
log item 1 of listDone
####################################
### ライブラリ内処理
set listPath to {"~/Library/Caches/com.apple.Music", "~/Library/Caches/com.apple.itunescloudd", "~/Library/Caches/com.apple.iTunesCloud", "~/Library/Caches/com.apple.iTunes", "~/Library/Application Support/com.apple.MediaPlayer", "~/Library/Containers/com.apple.Music.MusicStorageExtension", "~/Library/Containers/com.apple.Music.MusicCacheExtension", "~/Library/Containers/com.apple.Music.MPMusicPlayerApplicationControllerInternal", "~/Library/HTTPStorages/com.apple.Music", "~/Library/WebKit/com.apple.Music", "~/Library/Application Support/CloudDocs/session/containers/iCloud.com.apple.itunesu.plist", "~/Library/Preferences/com.apple.itunesstored.plist", "~/Library/Preferences/com.apple.itunescloud.plist", "~/Library/Preferences/com.apple.itunescloud.daemon.plist", "~/Library/Preferences/com.apple.iTunes.plist", "~/Library/Preferences/com.apple.iTunes.Gracenote.plist", "~/Library/Preferences/com.apple.itunes.altool.plist", "~/Library/Preferences/com.apple.Music.plist", "~/Library/Preferences/com.apple.Music.eq.plist", "~/Music/Music/Music Library.musiclibrary", "~/Library/IntelligencePlatform/Artifacts/appleMusicEvent", "~/Library/com.apple.AppleMediaServices/PersistedBags/com.apple.Music", "~/Library/HTTPStorages/com.apple.Music", "~/Library/Application Support/com.apple.MediaPlayer", "~/Library/Application Scripts/com.apple.Music.MusicCacheExtension", "~/Library/Application Scripts/com.apple.Music.MusicStorageExtension"} as list
repeat with itemPath in listPath
set strPath to itemPath as text
set ocidFilePathStr to (refMe's NSString's stringWithString:(strPath))
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
set listDone to (appFileManager's trashItemAtURL:(ocidFilePathURL) resultingItemURL:(ocidFilePathURL) |error|:(reference))
log item 1 of listDone
end repeat
####################################
### ByHost内処理
set listPath to {"$HOME/Library/Preferences/ByHost/com.apple.music", "$HOME/Library/Preferences/ByHost/com.apple.Music", "$HOME/Library/Preferences/ByHost/com.apple.itunes", "$HOME/Library/Preferences/ByHost/com.apple.iTunes"} as list
set strCommandText to ("/bin/mkdir -p $HOME/.Trash/ByHost") as text
do shell script strCommandText
repeat with itemPath in listPath
set strPath to itemPath as text
set strCommandText to ("/usr/bin/touch \"" & strPath & "\"") as text
do shell script strCommandText
set strCommandText to ("/bin/mv -f " & strPath & "* $HOME/.Trash/ByHost") as text
do shell script strCommandText
end repeat
####################################
### T
set listPath to {"com.apple.music", "com.apple.Music", "com.apple.itunes", "com.apple.iTunes"} as list
set ocidTempDirURL to appFileManager's temporaryDirectory()
repeat with itemPath in listPath
set ocidGoToTrashPathURL to (ocidTempDirURL's URLByAppendingPathComponent:(strPath))
set listDone to (appFileManager's trashItemAtURL:(ocidGoToTrashPathURL) resultingItemURL:(ocidGoToTrashPathURL) |error|:(reference))
log item 1 of listDone
end repeat
####################################
### C
set listPath to {"com.apple.music", "com.apple.Music", "com.apple.itunes", "com.apple.iTunes"} as list
set ocidFolderDirPathURL to ocidTempDirURL's URLByDeletingLastPathComponent()
repeat with itemPath in listPath
set strPath to ("C/" & itemPath) as text
set ocidGoToTrashPathURL to (ocidFolderDirPathURL's URLByAppendingPathComponent:(strPath))
set listDone to (appFileManager's trashItemAtURL:(ocidGoToTrashPathURL) resultingItemURL:(ocidGoToTrashPathURL) |error|:(reference))
log item 1 of listDone
end repeat
| 固定リンク
「Media Music」カテゴリの記事
- [Music]メタデータの文字化け置換(EU系の文字化けの置換) 少し増えた(2024.03.18)
- [shortcut]再生中の音楽をShazamでしらべてタイトルアーティストを設定する(2023.12.11)
- [Music]メタデータの文字化け置換(1つ毎処理)(2023.12.09)
- [afinfo]ミュージックファイルの詳細メタ情報の取得(2023.11.01)
- [com.apple.metadata]オーディオファイルのコメントにビットレートを入れる(2023.11.01)