Created
November 10, 2011 14:42
-
-
Save Eugeny/1354999 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import sys | |
import glob | |
import os | |
import sqlite3 | |
try: | |
format = sys.argv[1] | |
except: | |
format = 'artist - title' | |
for dbf in glob.glob('*.db'): | |
db = sqlite3.connect(dbf) | |
c = db.cursor() | |
c.execute('select * from music where LocalCopyPath is not null') | |
for row in c: | |
name = format.replace('title', row[11]).replace('album', row[12]).replace('artist', row[13]) | |
name += '.mp3' | |
try: | |
os.renames('%i.mp3'%row[0], name) | |
print '\n%s : %i = %s\n'%(dbf,row[0],name), | |
except: | |
print '.', | |
print '\ndone' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment