dougscripts.com

Archive for the
‘Bug or Feature?’ Category

November 13 '16 - 10:46 am
Another Ambiguous Property Value

Not too long ago, a version of the iTunes scripting definition used the new value “music” for the media kind property. Unfortunately, this caused confusion with the similar “Music” value for a playlist’s special kind property. This was eventually fixed such that “song” was used instead of “music” for the media kind property. All’s well now, right? We’ll never see a mistake like that again, right?

Never say never.

It happens that “songs” is an enumerator value for the search command as well as for the new shuffle mode property. And, unfortunately, when “songs” is used as the search command’s only value—eg: search somePlaylist for “my search text” only songs, indicating that one wants to search just song titles—some kind of ambiguity issue causes a reversion to the default all value. Thus, every tag is searched for the search term instead of only the song titles and you’ll get a lot more search results than expected. For example, in searching my Movies library for “Big”, I not only got “The Big Lebowski” and “The Big Chill”, but a bunch of other movies that had the word “big” in their description tag.

Ironically, a search of the scripting definition file may have caught this before “songs” was re-purposed for shuffle mode.

This affects at least one script of mine, Search Results to Playlist, which I’m fixing with a silly workaround using hard-coded enumerator codes in a run script handler. Yech.

November 11 '16 - 3:19 pm
Artist Photos

Kirk wrote about missing artist photos in iTunes for one of his Macworld columns recently. This is an effect that was introduced in iTunes 12.5 and the iOS 10 Music app. It is disappointing to have so many microphone logos and tiny artist photos in one’s library.

Several correspondents have inquired about fixing this with some kind of homebrewed kludge, but I’m afraid not. Artist images are handled internally by Apple and the iTunes/Music apps. There is no “artist image tag” or hook or cache or anything like that such that images can be supplied by the user.

September 15 '16 - 4:14 pm
Issue With Work and Movement Tag Text

(This post has been updated, see below.)

A Correspondent emaIed to point out that when text is entered in either the new Work or Movement Name tags and the text contains non-English characters they do not render correctly in Albums and Artists Views. Nor in the Info window:

So, watch out. This may be a display issue but I am not sure if Apple can fix it at their end or an update to iTunes is required.

UPDATE: FWIW, this is how it looks in the XML. Note that the Name tag is fine, but not the Movement tag:

UPDATE ALSO (September 16, 2016): This issue appears to have been resolved today after re-entering Work and Movement text.

UPDATE MORE (September 16, 2016): Spoke to soon. If the track is played then the NULL character returns. (Is that what that diamond-question mark character is called? Been a long time since I’ve seen it on webpages.)

June 26 '16 - 12:18 pm
Issue With Copying a Newly Converted File

I’ve been going crazy trying to track down a problem using AppleScript to convert a file and then duplicate the newly converted file’s track entry to a playlist. No matter what I tried, the original pre-converted track is copied to the playlist and not the new converted file. Here’s a stripped-down example:

tell application “iTunes”

set oldTrack to item 1 of selection

— convert oldTrack and get a ref to the newTrack

set newTrack to item 1 of (convert oldTrack)

duplicate newTrack to somePlaylist

— …but oldTrack gets copied

end tell

Come to find out, iTunes 12.4.1 gets fussy about converted files when iCloud Music Library is active. As soon as the new converted file is created (again, via AppleScript) and added to the library, iTunes goes into its “Waiting…” mode—waiting to upload the file to the cloud. This apparently prevents AppleScript from doing anything with the new track entry.

This reminded me of how iTunes will warn you about editing a track (that is, about using Get Info) while it is waiting to be uploaded:

Strangely, all the properties for the new track are available. So, I tried adding it to the playlist using its location (file path); I tried persistent ID‘ing it from library playlist 1 to get a reference to it; neither worked.

It wasn’t until I shut iCloud Music Library off in iTunes > Preferences… > General that a newly converted track entry could be copied to a playlist. After some more experimentation with iCloud Music Library turned back on, I tried setting up a loop that waited for the cloud status of the new track to change to uploaded. But, since it can take several minutes for this process to be initiated, I abandoned this.

Primarily this will be a problem for Quick Convert, which has an option to copy converted tracks to a new/selected playlist (and, I suppose, any other script that works similarly):

If iCloud Music Library is ON, the “Copy new tracks to playlist:” option is ineffective.

June 2 '16 - 10:55 pm
The player position Bug Fixed

This bug that prevented setting the player position while the player state is paused is fixed in iTunes 12.4.1

May 20 '16 - 7:12 am
Slight Growing Pains Continue

The podcast value for media kind will confuse older scripts that look for the podcast property of track. The podcast property for track (“is this track a podcast episode?”) was removed in iTunes 12.4. Similarly, the iTunes U property of track has also been removed and is now a value for media kind.

May 17 '16 - 12:01 pm
Setting player position Can Fail

Setting the player position while the iTunes player state is paused resets the player state to stopped and resets the player position to 0.

tell application “iTunes”

play — initialize the state to Play

pause — put iTunes in Pause mode

set player position to 5

log (get player state) — will be stopped

log (get player position) — will be 0

end tell

Attempting a workaround, I found that as long as the track isn’t paused, the player position can be set.

This did not occur in previous versions; setting the player position while paused would, as expected, move the play head to that position. In fact, Needle Drop uses a variation of this to begin playing a track at a user-set start time. Needless to say, this won’t work with iTunes 12.4. (Hat-tip to Correspondent Rob Robinson.)

[UPDATE: Needle Drop v5.3 addresses this issue.]

[UPDATE ALSO: this issue is fixed in iTunes 12.4.1.]

May 17 '16 - 9:34 am
Music vs music

The AppleScript issue in iTunes 12.4 whereby filtering special kind by Music fails is caused by a conflict with the new media kind property. One of the values it uses is music.

Bugs are being filed. (Hat-tip to Correspondent Nate Weaver.)

May 16 '16 - 4:45 pm
Busted: special kind syntax?

In iTunes 12.4, I can’t get a reference to the Music library playlist by doing this:

tell application “iTunes”

set musicPlaylist to (get some playlist whose special kind is Music)

end tell

…because iTunes apparently doesn’t recognize the Music value for special kind. When the script is compiled it changes the Music value to lower case:

tell application “iTunes”

set musicPlaylist to (get some playlist whose special kind is music)

end tell

…and the script fails. A lot of my scripts use this to target a particular media library, like Music or Movies.

I suspect, (maybe? perhaps?) that the new select command is related? But, until now, I haven’t been able to get any object to react to select. More as it develops.

UPDATE: Well, this works (coercing the value of special kind to text), but it shouldn’t have to be done this way:

tell application “iTunes”

set nonSpecial to every user playlist whose special kind is not none

repeat with aP in nonSpecial

if (special kind of aP as text) is “Music” then

log “HEY”

end if

end repeat

end tell

UPDATE ALSO: Correspondent Nate Weaver tweeted to remind me that the event code «class kSpZ» can be used instead of the boinked Music value.

UPDATE ALSO ALSO: Here’s the problem.

April 6 '16 - 1:56 pm
Play Counts Bug

There seems to be a fairly recent bug affecting track play counts–or plays–when the played count property of an iTunes track is changed with AppleScript. If iCloud Music Library or iTunes Match is enabled, the value will revert to what it was before being changed by AppleScript. It seems as though either the new play count for a track doesn’t get synced to the cloud or that the original value in the cloud has over-written the new plays value. Or something like that.

Several scripts here (Multi-Item Edit, New Play Count, New Last Played Date, et al) that allow you to edit the play counts of your tracks are affected by this bug, which only occurs if you’re also using iCloud Music Library or iTunes Match. I am not sure if versions of iTunes prior to 12.3.3.17 are affected or if, perhaps, the bug also occurs with a track’s skipped count (I wouldn’t be surprised).

I filed a bug report with Apple and it turns out it’s already an open issue, so Apple knows about it. Now we wait.

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