mandag den 17. november 2008

Automatic update of ITunes library

Intro
ITunes does not include functionality to look for new music and dynamically update the music library. All my music is store on a server so I needed an application that could:
  • Synchronize music files from server to clients
  • Update client ITunes libraries with new music files from server
The first bullet was solved easy with rsync, and the other was solved using a combination of Java and Applescript. Deep directory structures are supported (recursion) and already imported files are ignored, so it should only produce heavy load when alot of new files are added.

Limitations
  1. Albumart is not imported automatically using this approach.

Installation guideline
  1. Place the directory syncitunes in /Applications/
  2. Edit the settings in the top of the shell script in syncitunes/scripts/syncITunes.sh (rsync commands can be commented out if you dont need to sync with a server)
  3. Edit the settings in syncitunes/launchd/com.skyandyou.tools.itunes.sync.plist
  4. Copy or move the com.skyandyou.tools.itunes.sync.plist file to /Users/username/Library/LaunchAgents
  5. Add execution of the script to launchd (this will make the script run with the delay defined in com.skyandyou.tools.itunes.sync.plist) by running following command in Terminal:
    launchctl load /Users/username/Library/LaunchAgentscom.skyandyou.tools.itunes.sync.plist
  6. In ITunes, Preferences, Advanced: Change the settings so music wont be moved to the ITunes directory
  7. Test the synchronization and library update by executing this command in Terminal:
    launchctl start com.skyandyou.tools.itunes.sync
    Open an other Terminal and watch all the action in the system.log:
    tail -f /var/log/system.log


Relevant links
rsync
Applescript
Applescript through Java

Ingen kommentarer: