30 Days of Python: Days 4 and 5

I’m subscribed to an excellent MP3 Blog. Every few days, she collects a bunch of music, writes some notes about each song, and puts it all into a big zip file. I usually find at least a couple of songs I like in each post.

I had been downloading the zip file, unzipping it, adding it to iTunes, then manually adding the notes about each song to the lyrics tab in iTunes so I could see them on my iPhone as I’m listening to them. This sort of repetitive task is what python is built for!

Day 4: A script that opens a zip file, finds the title for the album from the text file inside, collects the notes and track numbers for each song, and extracts only the MP3′s from the zip file. Not uploaded, because on Day 5…

Day 5: Updated Day 4′s script to assign the album artist, album title, lyrics, and track numbers to the song’s ID3 tags. (Note: you’ll need to install the mutagen library for this to work.)

That’ll save me ten or fifteen minutes a week.

EDIT: Oddly, this script seems to have worked under Kubuntu but not on my windows PC. I think something went wrong with the zip extraction process. All the MP3′s extracted on my windows machine with this script sound like they’re being played under water and with bursts of static. Weird.

Posted on
June 5, 2010 10:24 am
 
 

Leave a Reply

Name and Mail fields are required. Emails will not be published.