Skip to content

Instantly share code, notes, and snippets.

@loderunner
Created November 26, 2015 11:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loderunner/88ba7e73747cc61c0fbb to your computer and use it in GitHub Desktop.
Save loderunner/88ba7e73747cc61c0fbb to your computer and use it in GitHub Desktop.
from mutagen.easyid3 import EasyID3 as Tag
from os import listdir
from re import sub
for f in listdir('.'):
if (f[-4:] == '.mp3'):
try:
tag = Tag(f)
except:
tag = Tag()
tag['artist'] = 'Steve Miller Band'
tag['album'] = 'Brave New World'
tag['date'] = '1969'
tag['genre'] = 'Rock & Roll'
tag['tracknumber'] = '%02d/%02d' % (int(f[:2]), 9)
# tag['discnumber'] = '%02d/%02d' % (2, 2)
tag['title'] = f[3:-4]
tag.save(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment