Push an iTunes playlist onto an Android phone

So here’s the thing: iTunes will let you export a playlist as plain(ish) text. This script will:

  • Parse that playlist file
  • Remove from it any tracks that are already on your Android *
  • Work out if your Android has enough free space to accommodate the new tracks
  • Push the tracks to the Android

This is not limited to Android, of course: any mp3 player that shows up as an external storage device (i.e. most things that aren’t iPods) will work. You can edit conf/config.cfg or set some command line flags to specify the mountpoint at which your device shows up and the path where it stores its music.

* The duplicate-detection will fail if you’ve previously transferred music to your player from somewhere other than your iTunes media tree (I’m not a magician).

The code:

Check it out, then run it as ./iTunes-to-Android.py -h to see the available options, or ./iTunes-to-Android.py <playlist_file.txt> to actually transfer some music.

Todo (if I can be arsed):

  • Generalise the playlist class then subclass it to handle playlists from Amarok, Exaile etc
  • Clean up some sub-optimal hacks I threw in to get the damn thing working

This started as a little bash script, but inevitably it’s grown into a massively over-engineered solution to a trivial problem. But hey, I like writing code, and this one may actually have some practical purpose.

Bookmark and Share

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>