You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I changed tell application "iTunes" to tell application "Music" which will make it work with Apple Music but not iTunes. I couldn't find a good way to check or failover to the correct application.
I've tried a few things. Checking os version, app/file exists, and wrapping the whole thing in a try block and running the on error. keep running into Expected end of line but found identifier.
Basically since the iTunes (or Music) library doesn't exist anymore it fails when it sees it.
The closest I got was doing this:
tell me
try
get application id "com.apple.Music"
set pathToPlayer to "Music.app"
on error
get application id "com.apple.iTunes"
set pathToPlayer to "iTunes.app"
end try
using terms from application "Music"
tell application pathToPlayer
try
set aTrack to the current track
set aArtwork to data of artwork 1 of aTrack
my write_to_file(aArtwork, "/tmp/currently-playing.jpg", false)
on error
log "error getting info"
end try
end tell
end using terms from
end tell
But since I need to wrap it in using terms from application to make it work, I'm back to square one.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will add compatibility for macOS Catalina and Apple Music while still keeping iTunes compatibly.
The only breaking change is to the now playing artwork as I could not come up with a clean way of keeping it compatible with iTunes.