iTunes playlist sync

Synchronize iTunes playlists from Apple Mac computer to Android phones. It has become unnecessary since Apple release Apple Music for Android, but it was a hugely useful utility until that was available.

note - apple mac only!


i'm a playlist fanatic - i love organizing my music with them, so i can easily put on the kind of thing i want right when i have a hankering for it. i'm very happy with iTunes playlists, and i urgently want to be able to easily synchronize my main ones - and the tunes that belong on them - to my android phone. i developed a Mac OS python script to scratch that itch, enabling me to replace my old iPod with my android phone. the script does incremental syncs, fairly efficiently ensuring accurate copies of a selected iTunes playlist and all its contained playlists and music files. it does so in a way that compensates for some very irritating logistical flaws in the standard android music players. see features, below, for details.

the script runs only on MacOS X with operational iTunes and requires python with appscript installed.

i developed and have been using the script since about October, 2009. i synchronize a collection of around 200 playlists (i did say fanatic, right?), which includes over 2600 MP3 tracks, quickly and cleanly. the script might be useful to you. it is free and open source (under a dual GPL and Apache license). if you're running Mac OS X and use iTunes, please give it a try and let me know what you think!

My page for the code:


basic synchronization:

  • incremental - only those playlists and music files necessary to rectify differences with the files already in the target hierarchy are copied.
  • the target directory on the device is also purged of playlists, track files, and directories which do not correspond to any elements within the subject playlist's hierarchy. (other files and directories are left undisturbed.)
  • the synchronization is done with respect to mounted filesystems, so simple USB storage mounting or smb/samba shares can be used (though the latter can be slow with lots of files

compensation for irritating android player flaws:

  • playlist folder nesting is reflected in the names of playlists on the device.

    i organize my playlists in shallow iTunes playlist folder hierarchies, to distinguish playlists according to various kinds of categories. typical iTunes sync mechanisms discard the folder containment info, sacrificing what is, to me, crucial distinguishing features of the playlists. it really sucks - and with playlistsync i compensated for it. playlistsync encodes containment info in the target playlist names - eg "rock_newwave" for the "newwave" playlist contained in the "rock" playlist folder.

    (it turns out that apple's old iPod - and maybe new iPod touch and iPhone? - synchronization discards the folder containment info, which i find supremely irritating. in that case i don't have as easy recourse, since they don't expose the sync via filesystem. fortunately, i prefer android phones... :-)

    further, target playlists are created for the iTunes playlist folders, so that there is a "rock" playlist containing all the items in the "newwave", "classic", "sparse", "prog", and "casual" sublists, or whatever.

  • put a short, silent "stub" track at the top of each target playlist, for device shuffle-play that, pathetically, always launches playlists with the first track.

    simplistic shuffle-play schemes, including those of Android's default music players, always launch with a playlist's first track, and shuffle from there. this script provides a workaround, optionally setting every target playlist's first track to a dummy "stub track". i use `a track that consists entirely of 1 second of silence`_.

  • provide a way to control ordering of playlists, using their names, that sorts the same in both iTunes and the android players.

    among my very many playlists i have several favorites. i want those favorites to wind up before their less preferred siblings in the sorting, yet i still often want to use the lower priority playlists. likewise, i want to be able to put some categories ahead of others. unfortunately, the standard android players impose an alphabetic sort on the playlists, so i have to use literal playlist name prefixes to control ordering. to compound this complication, the sortings vary between the two standard "Music" players and that of iTunes - so playlist sync has configuration to systematically transform specified playlist name prefixes to preserve sort order across the players.

    (this provision works with the composite folder + playlist nesting names, of course, to convey ordering within a category as well as among categories.)

  • failsafe - to avoid unintended deletion of music files in mistaken target directories, the target directory must contain a file with the name specified by TARGET_DIRECTORY_FAILSAFE_FILE. the user is prompted for creation of the failsafe file if absent, eg the first time the script is run.

Configuration and Operation

follow the python appscript instructions to install appscript in the python you'll be using to run the script.

configure the script by setting variable names in the script code and/or using command-line options, overriding the persistent configuration variables. see the script code, below the "Configuration Below" line, for the user-configurable variables, with explanations. invoke with '--help' to see the available options.

the synchronization target directory must exist and be writable.

to avoid unintended deletion of music files in mistaken target directories, the target directory must contain a file with the name specified by TARGET_DIRECTORY_FAILSAFE_FILE. you will be prompted for creation of the failsafe file if absent, eg the first time you the script targets that directory. you can tell the script to create the failsafe file when necessary, without prompting, by passing in "-c" / "--create-failsafe" that first time (or you can set ALWAYS_CREATE_FAILSAFE in the script to True, but it defeats the safeguard while set.)

invoke by applying the appscript-equipped python on, specifying the target directory with the '-d' option if you haven't configured the TARGET_DIRECTORY_PATH script setting:

python -d /Volumes/andUSD/Music/synchronized

Old Comments

  • Ben says:
    Jan 06, 2012 09:58 AM
    • This looks to be quite useful, but if I understand your description correctly, the script doesn't reproduce the actual folders from iTunes in Android. Instead, it simply indicates the playlist hierarchy. Is that right? So in android I'll still see a long list of playlists, but they will be labeled, eg. "Rock_hair rock" for the "hair rock" playlist? No navigating the folders like you can in iOS?
    • Ken Manheimer says:
      Jan 06, 2012 10:24 AM
      • I'm unfamiliar with iOS players, but your description sounds right - you get a long list of playlists, with progressively elaborated names as you go deeper in the folder hierarchies. I don't know how to organize playlists for android, or for any of the android players, so that they nest in a collapsable presentation, which is what you seem to be suggesting that iOS provides. In fact, I don't know that is possible, but would be happy to find out that it is, and how to represent the playlists so it happens! Thanks for your question...
  • Guy says:
    Sep 20, 2012 09:52 AM
    • Hi There - I have just started to use this (in conjunction with - - many thanks for the work! I am finding it's missing some files out - not sure why, the files it's missing are no different to others - i.e. they're from the same purchased album - some copy, others do not. The summary shows the correct number of tracks, and they are added to the M3U playlist correctly, they're just not copied over! Any pointers how to debug this? Cheers - Guy guy.bowden at
    • Ken Manheimer says:
      Oct 03, 2012 03:52 PM
      • Hey, Guy. Sorry about the delay replying. Your problem sounds like shortcomings in my provisions for filename internationalization, which I've stumbled over at various points in the course of playlistsync's development. I've just uploaded a new version which irons out all the name accommodation problems I've encountered - if you're still interested, give it a try and see if it helps. I hope it helps - I don't think I'll be able to spend more time on it to iron out new problems, if not.