dougscripts.com

February 2024

January 23 2018 - 5:23 pm

iTunes 12.7.3 Available

Apple has released iTunes 12.7.3 with support for HomePod and improved AirPlay interface. (Update: I'm not sure I am able to detect the "improved AirPlay menu".) More as it develops.

January 13 2018 - 11:06 am

Segregate Shufflable Tracks

A Correspondent queries:

"Do you have a script that can create a playlist of songs if they have the "Skip when shuffling" attribute ticked in the info panel? The reason is because when I sync those songs to the iPhone that feature doesn't sync along with it so they play regardless. The feature works on the Mac, just not on the iPhone."

The shufflable property of a track does not have a corresponding Smart playlist criterion or Songs view column. So, looks like the only way to identify these tracks en masse is with AppleScript.

Interestingly, the shufflable property works somewhat backwards. If the "Skip when shuffling" checkbox is set (and a checkbox when checked has a "true" value) the corresponding shufflable property is set to false; that is, "not shufflable". This might be the opposite of what you'd expect. For instance, when "Remember playback position" is set to true with a checkmark, its correponding bookmarkable property is set set to true (yes, allow this track to be bookmarked). Just kind of interesting. A little. But its important to keep in mind when you want to detect the correct (and not opposite) value.

Anyway, here's a script that will copy any tracks in the Music library set to "skip when shuffling" to an existing playlist:

tell application "iTunes"

set targetPlaylist to playlist "Skip Shuffle Tracks"

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

set theTracks to every track of musicPlaylist whose shufflable is false

repeat with aTrack in theTracks

set db to database ID of aTrack

try

if not (exists (get some track of targetPlaylist whose database ID = db)) then error

on error

try

duplicate aTrack to targetPlaylist

end try

end try

end repeat

reveal targetPlaylist

end tell

Open this in Script Editor by clicking the little script icon. Save it named whatever you like as a Script Bundle in your ~/Library/iTunes/Scripts/ folder so that it will be listed in the iTunes Script menu. I have already created a playlist in iTunes named "Skip Shuffle Tracks" so make sure you do, too. if you want to use a playlist with a different name then you will have to hard-code that name in the script where I have used "Skip Shuffle Tracks".

Whenever you run the script it will get a list of track references from the Music playlist where each has its shufflable set to false. It will iterate over this list and for each track it will first see if the track already exists in the target playlist; and if it does not the track will be copied to the playlist.

The second try block around the duplicate command ensures that if any track cannot be copied, such as a "dead" track, the script will skip it without erroring.

January 5 2018 - 11:01 am

Exporting Voice Memos

A Correspondent asked how to deal with Voice Memos when the Voice Memo track in iTunes is named using the text that was entered after recording it and its associated file is named using a date and time format. Specifically, he wanted to offload and archive some of the recordings but was concerned that the filenames were not sufficient to describe the contents of the file. Could the track name be transferred to the filename?

The script File Renamer is ostensibly for renaming a track's file in-place. But it can also be used to rename a copy of a file which can be saved to a user-chosen folder.

In this case, the Voice Memos have already been sync'd to iTunes from the iPhone. I've selected a single Voice Memo track in the screenshot, but batches are acceptable as well.

I originally named the Voice Memo "New Recording 3". But the filename of the selected track is something like "20180105 060425.m4a", indicating that I recorded it on January 5, 2018 a little after 6AM. File Renamer will create a copy of the file and name it "Voice Memo - New Recording 3.m4a" using the genre and name tags of the track, as well as some additional separator text. The original file remains unaffected.

BTW: I wasn't able to find a specific Voice Memos playlist in iTunes. (Was there ever one? I'm not a Voice Memos Guy.) So I created my own with a Smart Playlist matching all media where Media Kind is Voice Memo.

For more sophisticated offloading options, you may also want to try M3Unify.

Site contents © 2001 - 2025 (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.