dougscripts.com

January 2024

May 31 2015 - 10:42 am

Check For Library Corruption With xmllint

A Correspondent recently reported that a script which needed to read the current "iTunes Library.xml" file was failing. This XML file, as you may know, is exported periodically by iTunes and is pretty much an abridged output of the actual iTunes database. Even the XML file exported by iTunes' File > Library > Export Library... command was unable to be read. This suggested that there might be some corruption in the track entries, (I recently had a similar report and that database contained corruption that prevented the XML from being exported; the user reported that the XML had last been updated in 2012.)

iTunes can seem to behave normally even if there are tracks with corrupted track entry data or corrupted metadata in their files. So you might not even be aware of corruption until a third-party appliance elicits errors.

There is a command-line tool called xmllint that can find some corruption in the "iTunes Library.xml". You can run it from Terminal, or in a script like this:

set f to choose file

set rez to (do shell script "xmllint --valid --noout " & quoted form of POSIX path of (f as text))

This will error when it finds some badly encoded or improper UTF-8 text, which is often the culprit. Then it's just a matter of finding the troublesome tracks in iTunes and fixing the problems if possible. Usually this means just editing the tags in iTunes.

May 29 2015 - 6:38 am

Script of the Day: Size of Artwork

Size of Artwork will display the size (width x height) of the artwork of the single selected track.

Size of Artwork

This script works great when assigned a shortcut.

More info and download is on this page.

Previous Scripts of the Day. Subscribe to my RSS feed or follow @dougscripts on Twitter to get daily "Script of the Day" notifications.

May 28 2015 - 6:39 am

Script of the Day: Remove Leading-Trailing Spaces

Remove Leading-Trailing Spaces will remove any number of extra space characters at the beginning and ending of chosen tags (Name, Artist, Album Artist, Album, Composer, Genre, Grouping and Show) in the selected tracks.

Remove Leading-Trailing Spaces

More info and download is on this page.

Previous Scripts of the Day. Subscribe to my RSS feed or follow @dougscripts on Twitter to get daily "Script of the Day" notifications.

May 27 2015 - 8:23 am

NEW: Make Playlists By Years

Make Playlists By Years will create a new music track playlist for every year (or range of years) based on the Year tags of tracks in the Music Library. Optionally, Year playlists can be sorted into Playlist Folders by decade or filtered by a single Genre. (Accurate tagging is a must. Tracks with empty Year tags are ignored.)

In this screenshot, I've created playlists of the years 1970-2015 for the tracks in the "Pop" Genre and moved them to corresponding Playlist Folders named by decade:

Make Playlists By Years

All of the created playlists will be placed into a "Playlists By Years" Playlist Folder. The "Rock" playlists were created previously.

It can take a few moments for larger playlists to be assembled (200+ tracks). But, depending on the number of playlists it needs to create, the whole operation can be pretty brisk.

You'll notice that the playlists the applet creates are named with a final "." (dot). This is in order to distinguish them from any other playlists that are similarly named. See, the applet may re-create those playlists on subsequent runs and if it needs to create, for example, a new "Rock 1977." playlist it will delete every playlist with that name (otherwise, I'd have a dozen "Rock 1977." playlists in no time). So the distinguishing dot is just to make them somewhat different from the obvious.

Of course, if you want to preserve the playlists it creates, just duplicate and/or rename them.

More information and download is on this page.

(Be sure to see Playlist Manager which has batch-delete and batch-rename playlists functions; and Rescue Playlists from Folder and Move Playlists to Folder which remove/move playlists from/to Playlist Folders.)

May 27 2015 - 7:23 am

Script of the Day: PDF Adder

PDF Adder is a collection of two scripts that each assist with adding PDF files to iTunes as "digital booklet" PDF tracks. Each provides a method for easily supplying Author (artist), Album, Category (genre), Year, Rating and Description tag data which is then applied to the newly-added PDF track entry:

  • Add as PDF to iTunes is a PDF Service workflow that, when installed, will be available in the PDF pop-up menu of the Print Dialog. It allows you to save the current document as a PDF file (from any application that uses the Print Dialog) and add it to iTunes.
  • PDF Adder is an applet/droplet that will let you choose or drag-and-drop an existing PDF file and add it to iTunes. It can be installed in iTunes' Scripts folder for easy access from iTunes Script menu.

PDF Adder

Here are some suggestions for your own "digital booklets":

  • Album lyrics/liner notes
  • Music production notes
  • Manuals
  • Receipts/order confirmations
  • DJ set lists
  • Podcast addenda
  • Audiobook chapter synopses
  • Lecture notes
  • Sound effects indexes

Anything you can print, you can make into a PDF...and any PDF can be added to iTunes.

More info and download is on this page.

Previous Scripts of the Day. Subscribe to my RSS feed or follow @dougscripts on Twitter to get daily "Script of the Day" notifications.

May 26 2015 - 7:19 am

Script of the Day: Duplicate Playlist Folder as Playlist

Duplicate Playlist Folder as Playlist will copy all the tracks in a selected Playlist Folder to a new "plain" playlist, essentially duplicating the tracks as viewed when the Playlist Folder is selected.

Duplicate Playlist Folder as Playlist

Optionally, it can delete the selected source Playlist Folder and its contents (of course, the tracks remain in your library, but any playlists and sub-Playlist Folders it contains can be deleted).

More info and download is on this page.

Previous Scripts of the Day. Subscribe to my RSS feed or follow @dougscripts on Twitter to get daily "Script of the Day" notifications.

May 25 2015 - 6:20 am

Script of the Day: Remove n Characters From Front or Back

Remove n Characters From Front or Back will delete a specified number of characters from either the beginning or the ending of the Song Name, Album, Album Artist, Artist, Comments, Composer, Episode ID, Grouping or Show tag (or their "Sort" siblings) of each selected track.

Remove n Characters From Front or Back

Includes a Preview to check each selected track's tag before committing. The window is re-sizeable so that longer tags can be viewed more easily.

More info and download is on this page.

Previous Scripts of the Day. Subscribe to my RSS feed or follow @dougscripts on Twitter to get daily "Script of the Day" notifications.

May 22 2015 - 6:42 am

Script of the Day: Play Random Album

Play Random Album will quickly scan your library, create a playlist of a complete single album choosen at random and begin playback of the playlist created. Works great when assigned a keyboard shortcut. This is one of my favorite scripts.

More info and download is on this page.

Previous Scripts of the Day. Subscribe to my RSS feed or follow @dougscripts on Twitter to get daily "Script of the Day" notifications.

May 21 2015 - 5:57 am

Script of the Day: Reset Tracks Start-Stop

Reset Tracks Start-Stop will reset the Start and (optionally) the Stop Time of the selected tracks—or all the tracks of the selected playlist—to "0:00" and (optionally) their entire duration, respectively.

Reset Tracks Start-Stop

More information and download is on this page.

Previous Scripts of the Day. Subscribe to my RSS feed or follow @dougscripts on Twitter to get daily "Script of the Day" notifications.

May 20 2015 - 5:57 am

Script of the Day: Copy Tracks to Multiple Playlists

Copy Tracks to Multiple Playlists will copy the selected tracks to one or more chosen playlists.

Copy Tracks to Multiple Playlists

More information and download is on this page.

Previous Scripts of the Day. Subscribe to my RSS feed or follow @dougscripts on Twitter to get daily "Script of the Day" notifications.

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.