Last active
June 21, 2024 13:52
-
-
Save Kautenja/75e0c4e406bf91466a6846e9834de090 to your computer and use it in GitHub Desktop.
An applescript to refresh the metadata of a selection in the Apple Music application (with progress bar)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Music" | |
-- get the selection | |
set theSongs to selection | |
end tell | |
-- setup the progress bar | |
set theSongCount to length of theSongs | |
set progress total steps to theSongCount | |
set progress completed steps to 0 | |
set progress description to "Refreshing Songs..." | |
set progress additional description to "Preparing to process." | |
-- iterate over the songs | |
repeat with i from 1 to theSongCount | |
set theSong to item i of theSongs | |
-- Update the progress detail | |
-- get the metadata about the song | |
tell application "Music" | |
set theArtist to artist of theSong | |
set theName to name of theSong | |
end tell | |
-- update the progress bar with additional information | |
set progress additional description to i & "/" & theSongCount & " - " & theArtist & " - " & theName | |
-- reload the song metadata from disk | |
tell application "Music" | |
refresh theSong | |
end tell | |
-- update the progress bar status | |
set progress completed steps to i | |
end repeat | |
-- Reset the progress information | |
set progress total steps to 0 | |
set progress completed steps to 0 | |
set progress description to "" | |
set progress additional description to "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment