dougscripts.com

November 22 2019 - 1:01 pm

UPDATED: Rate Me! Rate Me! v6.0

For macOS 10.15 Catalina and later only. This stay-open applet watches your playing tracks and when one begins playing displays a notification-sized panel whereby a rating for the track can be entered. Features options to display only unrated playing tracks and timer preferences for how soon and how long the panel is displayed.
While you could easily rate the current track from the Music app's icon in the Dock, this script interrupts you and compels you to do so.

More information for Rate Me! Rate Me! v 6.0 and download link is here.

November 16 2019 - 2:57 pm

Accessing a Track's Multiple Artworks

In case you didn't know, a track entry in Music (and previously, in iTunes) can have more than one artwork image associated with it. In such cases, the first of its artworks is what I call the "display artwork" and the other artwork is what Apple calls...the "Other Artwork":

The "Album Artwork" image on the left is what is displayed throughout Music/iTunes as the artwork for the track. The "Other Artwork" doesn't get displayed anywhere except in the Artwork pane of the Info panel. And "Other Artwork" doesn't always mean other artwork singular; you can really go to town and add thousands if you want (probably; didn't try; crazy idea). Incidentally, I'm pretty sure only one image can be written a track's file metadata and that will be the "Album Artwork" image.

In AppleScript, a track contains artworks and each artwork is accessed by index: artwork 1, artwork 2...artwork 4732. The "display artwork" is always artwork 1.

I am currently preparing an update to the script Re-Apply Downsized Artwork, which, among other things, can insert a new down-scaled image as a track's artwork 1. If the track already has artworks, they are "pushed up" such that the current artwork 1 becomes artwork 2, the current artwork 2 becomes artwork 3, and so on, so that the new image can become the new artwork 1.

Here's the bug-or-feature part of the essay (mostly bug I'm thinking): When you ask for any other existing artwork greater than 1, Music gives up a parameter error. This makes it impossible for AppleScript to access any artwork data other than artwork 1.

I may release the update to Re-Apply Downsized Artwork that side-steps the "insert" feature, but I thought I'd explain why I haven't released it yet at all.

November 2 2019 - 3:15 pm

UPDATED: Coverscope v2.0

Coverscope is an applet that helps manage track and file artwork. It will display both the track entry artwork and the artwork metadata from the track's file:

If one or the other is missing, the extant image data can be applied or embedded to the other. If both artworks are missing, an image from the clipboard can be pasted or an image file dragged to the Track entry artwork well to apply and embed it to the selected track.

Additionally, the Track entry artwork can be copied to the clipboard or exported as a file.

Coverscope is free to try in Demo Mode. In Demo Mode, any combination of features can be used up to five times per launch. A registration code to remove this restriction is US$2.99. More information and download is here.

And here's a cool trick I've been using Coverscope for:
(more…)

October 29 2019 - 4:00 pm

macOS 10.15.1 and Music v1.0.1

I just updated the OS and the Music app. Happily, it appears the artwork issues are fixed and AppleScript can access the artwork data of a track (unless it's a file downloaded into the "Apple Music" folder). Additionally, playlist drags into and out of Folder playlists work as expected; it's just as tricky as it ever was in iTunes, but at least it's a sure thing.

There is still an AppleScript bug whereby delete playlist leaves a "ghost" playlist in the Sidebar until the next Music re-start. I have a few scripts in the pipe that rely on being able to delete playlists properly so this will need to be fixed before they can get posted.

Also, the reveal playlist command fails to scroll the selected playlist into view if it is not already in the Sidebar's view.

Otherwise, seems pretty solid.

October 29 2019 - 12:15 pm

Latest Batch of Catalina Updates

Busy busy busy! So much so that the email newsletter I've been aiming to release still ain't got out and I have yet to even look at my App Store apps. The latter will not run in Catalina. But here's a batch of scripts that do:
(more…)

October 28 2019 - 3:57 pm

Yes, There is Still an Artwork Issue

In case you haven't noticed: If you have downloaded a file from the cloud or have had Music provide artwork, the image data does not get written to the track's file, even though you will see artwork for a track throughout Music.

Additionally, there's no way for an AppleScript to access the artworks of these kinds of tracks.

If the files of your tracks had image metadata before updating to Catalina, then you probably don't have any artwork problems with those.

My specific issue is that files on machine A that have custom artwork I applied to them and that sync via Cloud Music Library do not have the custom artwork when I download them to machine B. Instead, they have whatever artwork Apple has assigned for the album.

I had hoped that there might be an AppleScript trick to workaround this, but as I mentioned above, AppleScript wlll error when attempting access the artwork data or raw data properties of these tracks:

tell application "Music"

set theTrack to item 1 of selection

count artworks of theTrack

--> 1 , accurately detects 1 artwork

get raw data of artwork 1 of theTrack

--> error number -1728

--> error "Music got an error: Can’t get raw data."

end tell

You can test this yourself, either with the script or by trying to copy the small artwork image displayed in the top left corner of a track's Show Info window and pasting it somewhere. It won't.

[UPDATE 10.29.19: Hey! Apple fixed many of these issues in the macOS 10.15.1 and Music v1.0.1 updates.]

October 24 2019 - 6:16 pm

iTunes Library.xml v. ITLibrary

A couple of years ago, Apple added a new option to iTunes Preferences:

This, and the fact that the support doc for this feature referred to the "Legacy library XML", was Apple's way of telling developers that the XML was going to go away.

The iTunes Library.xml file is a condensed version of the iTunes Library database periodically exported as a property-list-like text file by iTunes itself, generally whenever a change occurred to the database: you played or tagged a track, created or deleted a playlist, and so on. It can easily be imported and parsed quickly by an application, even an AppleScript. You've probably used an AppleScript from this site that asked you to turn the "Share" option on, right?

A year or two before the "Share" option was added, Apple introduced the ITLibrary framework, which is an API that developers can use to get info about the iTunes library (and now the Music and TV apps) instead of having to use the iTunes Library.xml file.

So anyway, the XML has finally gone away, effectively, since it is no longer automatically exported.

I've been trying to incorporate the ITLibrary framework into my projects whenever I can, especially for apps that need to display lots of tracks or playlists (like Media Folder Files Not Added).

But ITLibrary was apparently last updated for macOS 10.13. And now that iTunes has been split out into the media apps, it's usefulness over the XML file has not been improved.

(And please. Don't let me hear anyone suggest some groovy way of exporting the XML automatically. Forget about the XML. Unless it's for backups or something.)

  1. ITLibrary does not know about Work and Movement tags.
  2. ITLibrary does not know the difference between playlists in the Music app and playlists in the TV app. You can ask for discrete music tracks or TV tracks or movie tracks, but not discrete playlists from either app.
  3. ITLibrary does not know what a subscription playlist is. It's an Apple Music playlist you have added to your library. ITLibrary sees it as a Regular playlist.
  4. Ditto Loved and Disliked for tracks
  5. Ditto Loved and Disliked for playlists
  6. ITLibrary does not distinguish among types of cloud tracks (uploaded, matched, duplicate, etc)
  7. ITLibrary does not provide a Track ID which is used to correlate the tracks in a playlist to their library entries and vice versa.

And I'm sure I've run into other minor impediments. Wait, bonus gripe: converting decimal persistent IDs to hexidecimal. (Strangely, the ITLibrary required you codesign your app in order to use it, but I'm not seeing this prohibition in Catalina. Am I missing something?)

It would be great if someone over there could give us a dusted up version of ITLibrary. Meanwhile, there's still AppleScript.

October 23 2019 - 2:39 pm

UPDATED: New Shuffled Playist v2.0

This script will create a copy of the selected playlist or folder playlist with its tracks' play order shuffled--unlike Music's Shuffle modes which do not display the shuffled order of tracks.

More information for New Shuffled Playlist and download is here.

October 23 2019 - 12:41 pm

UPDATED: New Play Count v4.0

Set the Plays of the selected tracks to a user-entered value (they will all be set to the same value). If this value is 0 then the Last Played date of each track will be erased. (The Music app has the ability to "Reset" Plays to 0 from a track's Show Info window.)

Also see Reset Plays, Add or Subtract Play Count and New Last Played Date. iCloud Music Library users should beware of a potential bug.

More information for New Play Count and download is here.

October 23 2019 - 12:40 pm

UPDATED: Add or Subtract Play Count v3.0

For macOS 10.15 Catalina and later only. Add or subtract a user-entered number from the current Plays of each selected track. If the resulting Plays is 0 then the track's Last Played date will be erased--as if it had never been played.

Also see New Play Count and New Last Played Date.

More information for Add or Subtract Play Count and download is here.

Site contents © 2001 - 2024 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.