dougscripts.com

Managing Tracks

December 13 2019 - 9:41 pm

UPDATED: Track's Album to Playlist v4.0

For macOS 10.15 Catalina or later only. This script gathers the tracks in the Music library with the same Artist, Album, and Disc Number of the currently playing track (or, if no track is playing, the selected track) and copies them in track number order to a new Playlist named "Artist - Album". Accurate track-tagging is a must.

This works great when assigned a shortcut.

Latest version:

  • Accommodations for macOS 10.15 Catalina
  • Performance and security enhancements

More information for Track's Album to Playlist v4.0 and download link is here.

December 13 2019 - 8:22 pm

UPDATED: Disable Dated Tracks v2.0

This script will disable (uncheck) the tracks of the selected playlist whose last played date is before or after 00:00 (midnight) of a user-entered date.

Latest version:

  • Accommodations for macOS 10.15 Catalina and the Music and TV apps
  • Performance and security enhancements

More information for Disable Dated Tracks v2.0 and download link is here.

November 26 2019 - 12:04 pm

UPDATED: List MIAs v5.4

For macOS 10.15 Catalina and later only. This applet checks your Music or TV library for missing and presumed dead tracks--those tracks that have become disassociated from their file and which are listed with a "!"--and can delete them from the app or create a text file listing these tracks by last known File Path, Song Name, Artist and Album, which you can view using TextEdit.

Also see Super Remove Dead Tracks and Media Folder Files Not Added.

Free to use in Demo Mode: While in Demo Mode, dead tracks will be displayed and can be exported as a list to a text file. Delete from Music/TV and other features will be disabled.

To purchase a registration code and remove these restrictions, download and launch the app. Click "Register..." in its File menu and follow the prompts to purchase a code for $2.99. When your payment is processed, you will be emailed a registration code that will unlock the Demo Mode restrictions.

Latest version:

  • Adds support for the TV app - install in TV's Scripts folder
  • v5.3:
  • Corrects column order in export text
  • v5.2:
  • Fixes unusual issue when quit
  • v5.1:
  • Fixes invalid parameter issue some users were seeing that prevented launch
  • Additional Catalina accommodations

More information for List MIAs v5.4 and download link is here.

November 24 2019 - 11:53 am

UPDATED: Super Remove Dead Tracks v5.2

For macOS 10.15 Catalina or later. Scans the Music or TV app for tracks whose files are inaccessible or no longer available (so-called "dead" tracks) and removes them. Outputs a tab-delimited text log listing the tracks that were removed by Artist, Name, Album and last known file location. Optional test run mode allows you to log the tracks that would have been deleted.

Also see List MIAs and Music Folder Files Not Added.

Latest version:

  • Adds support for the TV app - install in TV's Scripts folder
  • v5.1:
  • Fixes unusual issue when quit
  • v5.0:
  • Accommodations for macOS 10.15 Catalina
  • Performance and security enhancements

More information for Super Remove Dead Tracks v5.2 and download link is here.

November 24 2019 - 9:49 am

UPDATED: List MIAs v5.3

For macOS 10.15 Catalina and later only. This applet checks your Music library for missing and presumed dead tracks--those tracks that Music is unable to associate with a file and which are listed in Music with a "!"--and can delete them from the Music app or create a text file listing these tracks by last known File Path (if available), Song Name, Artist and Album, which you can view using TextEdit.

Also see Super Remove Dead Tracks and Media Folder Files Not Added.

Free to use in Demo Mode: While in Demo Mode, dead tracks will be displayed and can be exported as a list to a text file. Delete from Music and other features will be disabled.

To purchase a registration code and remove these restrictions, download and launch the app. Click "Register..." in its File menu and follow the prompts to purchase a code for $2.99. When your payment is processed, you will be emailed a registration code that will unlock the Demo Mode restrictions.

Latest version:

  • Corrects column order in export text
  • v5.2:
  • Fixes unusual issue when quit
  • v5.1:
  • Fixes invalid parameter issue some users were seeing that prevented launch
  • Additional Catalina accommodations

More information for List MIAs v5.3 and download link is here.

November 22 2019 - 1:03 pm

UPDATED: Copy Tracks to Multiple Playlists v5.0

For macOS 10.15 Catalina and later only. This script will copy the selected tracks to one or more chosen playlists.

Also see Remove From Other Playlists.

More information for Copy Tracks to Multiple Playlists v 5.0 and download link is here.

November 22 2019 - 1:03 pm

UPDATED: Comments Search v2.0

For macOS 10.15 Catalina and later only. This script will search the Comments tags of the Music library tracks for a user-entered text string and copy the track results to a discrete playlist.

More information for Comments Search v 2.0 and download link is here.

October 16 2018 - 12:51 pm

Unfinished TV Shows

The TV Shows library can show you Watched shows and Unwatched shows. And how much time is left in shows you've started. But there's no way to sort these unfinished tracks or gather them all together, say, with a Smart playlist rule.

So here's a script that will find TV Show tracks that haven't been played all the way through and copies them to a new appropriately named playlist:

property tvPlaylistName : "_Un-Finished TV Shows"

tell application "iTunes"

set tvLib to (get some playlist whose special kind is TV Shows)

-- delete any old playlists

if (exists playlist tvPlaylistName) then

delete (every playlist whose name is tvPlaylistName)

end if

-- recreate, add date in playlist description

make new playlist with properties {name:tvPlaylistName}

tell playlist tvPlaylistName

set description to date string of (get current date)

end tell

-- examine each TV track

repeat with i from 1 to (count tracks of tvLib)

try

set aTVTrack to track i of tvLib

if (bookmark of aTVTrack) > 0.0 then

duplicate aTVTrack to playlist tvPlaylistName

end if

end try

end repeat

end tell

Open this in Script Editor by clicking the little little script icon above. Save it named whatever you like with the Format "Script" (.scpt) in your ~/Library/iTunes/Scripts/ folder so that it will be listed in the iTunes Script menu.

This script will need to be run manually every so often in order to refresh the playlist. Follow the instructions on this page to add a keyboard shortcut.

For Smarties: tracks in other libraries use the bookmark property (some by default) as well. Podcasts, Movies and Audiobooks can be sorted using a smilar script that targets those special kind libraries.

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.

November 27 2017 - 10:40 am

Internet Radio Streams Playlist

I recently swapped receivers (or, I should say, amplifiers) in my office. I was using a decent mid-priced Sony receiver to power two zones of speakers: a set of Bose 301s and a "near-field" set of cheap desktop speakers and sub-woofer. I replaced it with an unused Onkyo amp I had purchased a few years ago. As a result of the switch, I no longer have a radio tuner in the configuration.

But, as it turns out, I don't need one. I'm lucky enough to have all the local Boston-area stations I listen to available in the Internet Radio section of iTunes. I never paid much attention to them before since I had a receiver. This gives me some nice advantages:

  • Internet radio feeds seem to precede the part of the broadcast audio chain where the signal has the life processed out of it. I no longer have to tolerate crappy broadcast audio.
  • Almost all my music sources are available digitally in one application, iTunes. Pandora is the only audio service I use requiring another app, but I mostly listen to it on mobile.
  • I can AirPlay iTunes all over my house.

The only downside so far is that I can't listen to live local play-by-play sports broadcasts because, for various "contractual obligations", these broadcasts can't be internet-'casted.

One quibble I've always had with iTunes Internet Radio is that it's not exactly easy to manage the stream tracks. Finding them in the Radio list can be a chore and sometimes stations will disappear and the re-appear with a different URL. There's not much I can do about either of those issues.

But to make life a little easier, I have created a "__Radio" playlist to which I have dragged the stream URLs I regularly listen to. I've also create a little script to quickly pull up the __Radio playlist with a keyboard shortcut:

tell application "iTunes" to reveal playlist "__Radio"

I've assigned Option-Command-R as a keyboard shortcut to the script.

One other thing I've done is to store the URL address of each stream track in the __Radio playlist. I grab the address property of each URL track and then paste it into a text document for safe keeping:

Later, if necessary for any reason, I can open the address with something like this:

set theStream to "https://audio.wgbh.org/otherWaysToListen/wgbh.m3u"

tell application "iTunes" to open location theStream

This will create a new URL track in a playlist called "Internet Songs". I then drag the track to my __Radio playlist and usually delete the "Internet Songs" playlist, although keeping it around isn't a bad idea either.

Site contents © 2001 - 2019 (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 interrupt the one doing it.