iTunes Remote Commander
Version 0.5

What it iTRC?

iTRC is a web-based front end for iTunes. You can control iTunes using a web browser on a remote computer (even over the web, if you really wanted to). [View Screenshot #1]

I have a computer hooked up to my stereo and wanted to be able to control music from any other PC in the house. So I run iTunes on the music server and it plays thru my stereo, and using iTRC in a web browser I can browse/search my music library, create playlists, etc.

For those of you that collect live recordings (that may not be mp3 or may be mp3 without proper id3 tags) you may notice that the tracks appear in iTunes similar to this: gd1989-10-16d2t1 which is't very helpful when you are looking for a certain Dark Star. If you store each live show in its own folder, I have built a facility which lists the text files in an album's folder so you can view the setlist. [View Screenshot #2]

The page layout and usage of iTRC is closer to Squeezebox’s SlimServer software than to iTunes. You basically search/browse for the tunes you want and add them to the current playlist. You can reorder and save this playlist and then recall it later.

This screenshot gives a brief overview on how to use iTRC.

NOTE: This app is free for you to download, install, and use. It includes the source code. But you are on your own! I just don’t have the luxury of time to offer support. If you know PHP, or you know a similar language and like to tinker, or you know no programming but like to tinker, then this might be something you’d like to play around with. Have fun!

And just to CMA, I have no responsibility over anything that happens as a result of installing and/or using this software.

The download link for iTRC is at the bottom of this page.

Server System Requirements

  • Windows 2000/XP (and maybe others)
  • iTunes 6 (and maybe others)
  • IIS or Apache web server, either one configured for PHP
  • PHP 5 (and maybe others)

    Client System Requirements

  • A web browser (tested on IE 6 and FF 1.5)

    • Place the iTRC folder somewhere where your web server can access it
    • Ensure you have COM setup for PHP
      In your php.ini file, look for the [COM] section. Use the following settings:
          com.allow_dcom = true
          com.autoregister_typelib = true
          com.autoregister_verbose = true
    • Ensure your web server has security privileges to access iTunes
      Method One (not so secure, not for production servers):
      1. Open the service for your web server in Admin Tools -> Services
      2. In the Log On tab, choose “This Account” and provide credentials for the currently logged in user.
      3. Restart the service

      Method Two (time consuming and much more involved): This site below goes through step by step. Keep in mind that the user for IIS is IUSR_YourComputerName and for Apache it will most likely be the System account.


    Open the globals.php file. At the top is a series of variables which you can customize to your needs (eventually these will be implemented as constants). The default values should work fine in most instances.

    Variable & Default Setting Description
    $nowPlayingRefreshInterval = 5000; Frequency, in milliseconds, that the “Now Playing” window is updated. You can set this so the page updates almost in real-time, but doing so may stress your server and/or use more throughout than desired.
    $tempPath = $_ENV['TMP']."/"; Path to your temp files. This is used to store album art for the current track into a temp file. Include a trailing slash on the path. This path must be writable by the web server.
    $artistFile = $_ENV['TMP']."/itrc_artists.txt"; Path and filename for the artists list file. This file must be writable by the web server.
    $scriptTimeLimit = 60; Time limit, in seconds, for page load. Loading the initial list of artists list can take some time (10 seconds per 2000 tracks on my server). If you get timeout errors, increase this number.
    $listCharWidth = 40; Number of characters to display for each list item (left column) before truncating and adding “…”. If titles are wrapping, lower this number.
    $listDetailCharWidth = 52; Number of characters to display for each detail line in the left column list before truncating and adding “…”. If detail lines are wrapping, lower this number.
    $playlistCharWidth = 32; Number of characters to display for titles in the playlist before truncating and adding “…”. If titles are wrapping, lower this number.
    $defaultPlaylistName = "itrc_playlist"; Name of the iTRC main playlist (only visible within iTunes itself)
    $defaultArtImage = "images/no_art.gif"; Image URL if no artwork is available in the media file.


    The page layout is four IFRAMEs with surrounding DIVs. The content for each IFRAME is defined in the CSS file, but this is not a table-less design, as much of the data is tabular in nature.

    Most everything is defined in the CSS file, and any images used exist in the images folder.

    Some Notes on How it Works

    Page Communication: There are three IFRAMEs: The Now Playing page, the Left Column List page, and the Playlist page.

    The Now Playing page uses AJAX to update itself every few seconds by default. When it notices a track change it updates the Playlist page accordingly.

    When the Playlist page notices a change in play-state, it updates the Now Playing page.

    Ordering Playlists: As of version 6, iTunes does not provide a programmatic means of sequencing playlists (other than “Shuffle”.) If you notice that your playlist sequence is screwy, go into iTunes on the server and sort the playlist by sequence number. That will take care of that.

    Dealing with Artists: iTunes doesn’t give us an easy way to obtain a list of artists. The only way is to iterate through each track in the library and grab each artist, avoiding duplicates. This can be very time consuming and is unacceptable when browsing page-by-page through your artists. To fix this, I create a text file the first time iTRC is loaded. This can take a minute or more, depending on the size of your iTunes library. This text file contains a unique list of all artists in your library. Subsequent visits to the Artists page pull from the text file rather than the iTunes library. Exponentially faster. If you ever need to re-create the text file (due to additions to your library, for example) just click the "Refresh Artist List" link in the Left Column page when viewing Artists.

    About the Code: This is not the most elegant code I’ve written, and there is much room for improvement and optimization. I wrote iTRC over a few days in a caffeine-fueled coding frenzy in order to get a working app in place at my house. Version 0.5 works and I will make improvements as the needs arise.

    Download iTRC 0.5 (160K)