Skip to content

Instantly share code, notes, and snippets.

@jaymzcd
Created April 23, 2014 16:47
Show Gist options
  • Save jaymzcd/11223100 to your computer and use it in GitHub Desktop.
Save jaymzcd/11223100 to your computer and use it in GitHub Desktop.
Meh, can't be arsed :) not all tracks have id3 "files" it seems, and not all them have id3 tags! :) Will let you sort this out in some fancy tool way via iTunes or something, probably going OTT this way! :)
#!/usr/bin/env python2
import os
import re
for root, dirs, files in os.walk('.'):
for file in files:
if file[-1] == '0':
mp3 = os.path.join(root, file)
print "MP3: %s" % mp3
id3 = os.path.join(root, '%s%s' % (file[:-1], '1'))
with open(id3) as id3_file:
content = id3_file.read()
artist = re.search('artist=(.*)', content)
title = re.search('title=(.*)', content)
album = re.search('source=(.*)', content)
if artist and title and album:
print "%s%s%s.mp3" % (artist.group(1), title.group(1), album.group(1))
@jaymzcd
Copy link
Author

jaymzcd commented Apr 23, 2014

http://files.u-dox.com/jc/sebrio.zip (5.6Gb) → give that ~6 minutes to copy! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment