-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with AppleScript File #45
Comments
Same here, from what I can recall anything that says "iTunes" must be changed to "music". Then again I can't insure that will help solve the problem completely. |
Could you tell me wat you've changed? Can't get it to work. (macOS 14.3, iMac Pro 2017) |
@etrahretep, let me know if method of sharing it doesn't work. My code is on the right. Also, just in case, here's a zip copy of my modified "get current track.applescript" |
I'll try to make a PR later today with the update. |
Thanks! but unfortunately only working in Spotify. When playing in M music scriptditor gives me error: error "De variabele currentPosition is niet gedefinieerd." number -2753 from "currentPosition" (Dutch) |
Actually it is macOS 14.4 latest dev beta, iMac Pro 2017. Could that be the problem? |
Thanks for pointing that out. I don't use Music so it was a lazy fix. However, I just tested a fix, and artwork for Apple Music is working for me now. Here's the updated file. I'll update the PR later. |
Hero! Never would have found out "favorited" |
Glad to help! Needed a "win" from some of my other projects. |
Other question then. Spotify uses a different method for retrieving albumart. Music doesn’t work flawlessly. Many times a previous album is used for a different song. Or stays grey. Especially when quick changing songs/albums |
From what I could tell as I debugged the code yesterday, they work differently. @Pe8er used a Spotify API to get the URL of the album artwork. That's why Spotify works more reliably. For Music, the AppleScript retrieves the raw data of the artwork, converts it into a file, and temporarily saves it to your computer. The AppleScript then almost immediately deletes the image. For both, this happens when the widget recognizes the song has changed. I'll add that I can read and debug this widget, but I wonder if I can make any improvements. I'm just not that familiar with AppleScript. |
After this discussion started up, it made me want to jump in and fix my fork of this widget. @mdjhnson, I appreciate you getting the script to work again. I didn't realize those unknown characters were in the script file. The problem with Music album art showing previous covers that you've downloaded, is that Ubersicht caches the images. It may not be Ubersicht itself, but probably the browser rendering engine it uses underneath. To fix it, the name of the cover needs to be different every single time to force it to update. I came up with the following to fix the problem. I have it name the cover file to the current Epoch Timestamp in seconds, which is how many seconds have passed since January 1st, 1970, so it is guaranteed always to be different from the previous. There is a wonky fix here to get the seconds out of scientific notation (example: 1.XXXXE+9), which applescript defaults to for some reason, by converting the number to inches and then to a string, which changes something like 1.709835265E+9 to 1709835265. This change goes somewhere around line 157.
Additionally, the logic in the
Feel free to take my changes and add them to your PR if you want. |
@etrahretep You absolutely can not edit the script file in any editor except for the Script Editor app or it will mess up the encoding and go back to what started this problem in the first place. Redownload @mdjhnson's script, open it in Script Editor, and make the changes there and save it. Additionally, depending on your locale and how dates are formatted on your specific system, you may need to change the date that I inserted. I am in the US, so the date is US formatted. |
Thanks. Needed that input. |
@dionmunk, I see what you're talking about. This original code doesn't always guarantee unique filenames. That's a good solution that you employed. Thanks for improving the removal and saving of the artwork! I just changed the code and updated the PR.
|
I had a problem with the AppleScript file. I had to combine lines of code for it to work and remove some special characters.
I used Script Editor to help me identify all the errors.
The text was updated successfully, but these errors were encountered: