Spiboso

Software for desktop and mobile.

Tuner

Command line control of your iTunes® library

Update track locations, list track information, and control playback, all from the command line. Requires .NET 4.0.
Download
 

Commands

There are ten commands: Show, Replace, Add, Delete, Play, Pause, PlayPause, Stop, Prev, and Next.

  • Show requires a single command, one of:
    • locations prints ID and file system location of each track.
    • tracks prints ID, Artist, Album, Name, Year, Length, and Rating of each track.
    • current prints Artist, Album, and Name of the current track.
    • playlists prints ID, name, and track count of each playlist.
  • Replace requires two arguments. Searches through track locations (file names), replacing any instance of the first argument with the second argument. Surround argument with quotes if it includes spaces.
  • Add requires one or more file names or patterns. Adds file(s) to the library.
  • Delete requires a single track ID. deletes the specified track.
  • Play requires a single track ID. Plays the specified track.
  • Pause pauses playback.
  • PlayPause toggles between play and pause states.
  • Stop stops playback.
  • Prev jumps to the beginning of the current track, or to the previous track.
  • Next jumps to the next track.
 

How It Works

Tuner began as a tool to fix file location information after moving or renaming music folders. When iTunes is unable to find a file, the iTunes COM Interface doesn't return anything for the track's location. However, the last valid location will still appear in the iTunes Music Library.XML file.
By falling back to the information stored in the XML file, it becomes relatively easy to search and replace track locations.
 

Examples


List all missing tracks

Missing tracks will begin with file://localhost/. Pipe output to findstr to display only the missing tracks
tuner.exe show locations | findstr file://localhost/

Search and replace track locations

Let's say you've moved your entire music collection from D:\Music to E:\Music. If you run:

tuner.exe show locations

You'll see that the locations now begin with file://localhost/D:/Music, since iTunes® cannot find the files.

To update the location of every track in the library, use the command:

tuner.exe replace file://localhost/D:/Music E:\Music
or
tuner.exe replace D:/Music E:\Music
In either case, Tuner will remove the file://localhost/ portion, update the matching part of the path, and replace any forward slashes with back slashes.

Since Tuner will ask for confirmation for each and every match, you may want to use the /Y switch:

tuner.exe replace /Y D:/Music E:\Music