Created
August 12, 2012 22:26
-
-
Save kazimuth/3334942 to your computer and use it in GitHub Desktop.
Python script to rename your music files!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#James Gilles, 2012 | |
#DWTFYWWI License | |
from mutagen.easyid3 import EasyID3 | |
import os | |
print "input directory for processing: " | |
path = raw_input() | |
os.chdir(path) | |
file_list = filter((lambda x: '.mp3' in x), os.listdir(path)) | |
for i in file_list: | |
print "file: "+i | |
try: | |
current = EasyID3(i) | |
newname = current["title"][0] + ".mp3" | |
newname.replace(" ", "_") | |
del current | |
print "renaming "+i+" to "+newname | |
os.rename(i, newname) | |
except: | |
print "...that file didn't work for some reason." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment