This script reads your iTunes library and copies specified playlists to any destination folder. It also keeps track of any files that may have been updated since the last sync and copies those across too (e.g. album art updates).
Download the script here
Source code
This script will probably only work on Mac OS X. I think it would need some changes to work on Windows which I'm not interested in doing. You will also need Perl installed and also Math::Round and File::Copy;. To install these:
cpan Math::Round File::Copy
Stick the file in some appropriate directory, such as /usr/local/bin and give it appropriate permissions:
sudo cp async /usr/local/bin sudo chmod +x /usr/local/bin/async
The script should be installed. You will now need to configure it.
There are two ways to configure the script. The first is to simply edit it with a text editor and replace various variables. The other is to create a configuration file. We'll assume you wish to do the latter.
Create the file ~/.asyncrc and put the following inside it, replacing as needed:
# Async config file # Your iTunes folder, typically /users/HOME/music/iTunes/ itunes=/users/REPLACE_ME/music/itunes # Where you want your music copied to (e.g. your USB or Android device) dest=/volumes/sd card/music # A list of playlists you want copied. For all your music, then add playlist=library playlist=bob dylan playlist=hard playlist=pink floyd playlist=favourites playlist=sync
Save this file and then run async (simply type async at the command line).
You can create multiple configuration files like the above for various needs (e.g. one to sync a usb thumb drive for your car, another for your phone and so on). To use them, simply pass the configuration file as an argument. For example:
async ~/.carsync
The configuration file accepts the following options:
The itunes argument specifies where the "iTunes Music Library.xml" file is located. This filename can be changed with itunes_xml (below).
itunes=/users/matt/music/itunes
The destination directory for your files.
dest=/volumes/sd card/music
The filename for your iTunes XML library. Default is iTunes Music Library.xml
itunes_xml=iTunes Music Library.xml
Playlist to sync. Can have multiple entries. Use 'library' to sync entire iTunes library.
playlist=bob dylan playlist=sync
Set to 1 to enable information output (default = 1)
info=1
Set to 1 to enable verbose output (default = 0)
verbose=1
Set to 1 to enable debug output (default = 0)
debug=0
Set to 1 to disable copying for debug purposes (default = 0).
no_copy=0
Set to 1 to disable file/folder deletion for debug purposes (default = 0).
no_delete=0
Directory to store the local changes database (default = ~/.async)
db_dir=~/.async
File to store the local changes database in (default = autogenerated)
db_file=carsync
The most common problem is going to be the Perl directory. To fix this, type:
which perl
This should give you a directory - e.g. /usr/bin/perl - edit the async file to put it on the top line, prefixed with a shebang. For example:
#!/usr/bin/perl
This script almost certainly won't work on Windows and probably never will. Sorry.