Saturday, January 9, 2010

zTunes released

As promised in yesterday's entry, I'm releasing my digital media management software (ztunes) to the world.  It's hosted at github:  It is written in Ruby and based on "rake", the Ruby equivalent of "make".  It currently has a long way to go but already does a lot. 

You can download the Ruby gem here:  (It is not currently in any sort of gem repository.)  It defines its gem dependencies, but you'll also need the Unix tools ffmpeg, flac, and lame.  It will run on Linux and Mac but currently has some trouble on Windows since it is dependent on symbolic links for some of its functionality, which Windows doesn't support.

My motivation for writing this was that iTunes is really inadequate for managing a media library unless (a) you only want to play on iPod (or other Apple) devices and (b) you are willing to let iTunes be in control of ripping and encoding.  This didn't work for us for two reasons: we have Squeezeboxes on all the stereos, and I want to rip my CDs to a non-proprietary, lossless format (that means flac, which iTunew doesn't support.)  We also have music that has been aquired in various other forms (MP3s from Amazon, AAC from iTunes, WMA from Rhapsody) and want to be able to play all the music on all the devices, without transcoding it all down to a least-common-denominator.  (In other words, if Squeezebox supports WMA but iPod doesn't, let Squeezebox play off the original WMA but let iPod play the transcoded version.)  And this should be transparent to the rest of the family.

There are several basic tasks in managing the media library that zTunes automates:

  • Content ingestion.  I've got a "drop" folder, into which I want to drop the originals of my media, in whatever form, and have them be analyzed, metadata extracted, and filed into a unified library based on its metadata.  My metaphor here is the gas tank of an M1 tank: you can pour anything combustible (gasoline, jet fuel, diesel, used cooking oil) into the tank and it figures out how to burn it.  Currently it maps a media file to a filename by using the author/album/title tags for audio or the title tag for video; audio files are named like "The Who/Who Are You/Squeezebox.flac". 
  • Transcoding.  Not all devices play all device types.  So ingested content also needs to be transcoded into alternate formats, which are maintained as parallel directory trees.  The transcoded trees are transient; they are merely shadows of the "authoritative" tree.  Some files may need be transcoded to multiple formats; for example, video files ripped from DVD or transferred from TiVo might be transcoded to 480 x 320 video for iPhone but 320 x 240 for the older video iPods. 
  • Syncing.  I use the Windows program "Tag&Rename" to edit the metadata tags on my media files, to normalize genres, naming details like "The Cars" vs "Cars, The", "Vol 1" vs "Disk Two", etc.  When I edit the metadata on an "original" file, I'd like the file to be renamed accordingly, and metadata changes to be reflected in the transcoded copies.  When I delete an original, I want the transcoded copy to go away.  Etc.
  • Device management.  I would like to have a single directory for each device type, that I can point device-specific library management software (iTunes, Squeezecenter, Creative Explorer) at, and it will see the right view of the media library for that device (will only see files it can play; will see them in the "best" format available for that device.) 

One thing it does not do yet is manage the integration of your external media library into iTunes (iTunes is particularly bad at dealing with files you didn't acquire through iTunes.) 

See more in the README file here:

I'm currently using this to manage a library of ~8,000 media files in half a dozen formats.  I'd love to get some more users -- drop me a note if you're interested! 


  1. Wow, that sounds like a lot of work, but it sounds like you've made much progress. Congrats!

    You might have tried it already, but there is a FLAC/Vorbis plugin from Xiph that adds support for those formats to iTunes here
    I can't vouch for it since I use Apple Lossless (for iPod playback) and it doesn't look particularly well-maintained.

  2. NTFS does support symlinks, it's just not very well known.
    They're called 'junction point':

  3. I was aware of junction points, but was under the assumption they had serious limitations as replacement for symlinks. Can they be removed like ordinary files (and removing them just removes the link)? Can I create 10,000 of them cheaply? Do they work for files as well as directories? I had thought they were only for directories.

  4. Hey Brian,

    Reading through the Wiki page shown above, it looks like Windows Vista supports a more advanced version of Junction Points.

    I've tested it on my Vista machine and it seemed to work nice. Only creating a hard link resulted in an Access Denied error.

    I'm not sure if you're running on Vista...?


  5. Looks nice -- and it appears the motivation was exactly this. So there's hope.

    I'm currently running on XP, but thinking of moving to W7 soon.

  6. so...sounds interesting, i'm always up for a better way to manage my library. iTunes never worked well for me b/c it really chokes on large libraries (~60k items, ~300GB). When I was on Windows, I found Winamp worked much better for me (and it was a great help at tagging my some respects better than Tag&Rename). Now I'm on Linux, and I've thus far been less satisfied with my alternatives. I can always try this, but it sounds sort of invasive to run it on top of my current, before I try putting my library somewhere to try this, what's your expectation of how it will perform?