Search code examples
pythonitunesusb-driveplaylist

Extract mp3 path from a iTunes playlist


I want to write a program in Python which would allow me to populate a folder with mp3 files extracted from an iTunes playlist.

Here's why: my car has a stereo which can read USB drives, so I want to populate my USB drive with my favourite songs which are already organized in iTunes.

Is that possibile? I've checked iTunes APIs but could not find anything useful...

Thanks

Matteo - Italy


Solution

  • I don't have a ready-made solution, but I could help you on your way towards making a solution yourself.

    The playlist parsing would be the most difficult part. Populating your USB drive should be simple with the shutil and os modules and other tools, so I won't address that part.

    You could do a search for "itunes" in PyPI, a.k.a. the Cheese Shop. The "hachoir-parser" package looks promising. You could also investigate the format of the iTunes library files and cobble a solution to retrieve the information that you want. It doesn't use the API, but for your purposes, it might be adequate.

    Hope this is helpful, at least a little bit.