Skip to content

Instantly share code, notes, and snippets.

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 ZachSaucier/f51e608ac75e8ed6e96cd54a9ec103b0 to your computer and use it in GitHub Desktop.
Save ZachSaucier/f51e608ac75e8ed6e96cd54a9ec103b0 to your computer and use it in GitHub Desktop.
import os, glob, eyed3
os.chdir("./")
for file in glob.glob("*.mp3"):
filename = os.path.basename(file)
if " - " in filename:
artist, track = filename.split(' - ')
if "".__eq__(track):
track = artist
artist = ""
audiofile = eyed3.load("./" + filename)
audiofile.initTag()
if not "".__eq__(artist):
audiofile.tag.artist = artist
audiofile.tag.title = track.split('.mp3')[0]
audiofile.tag.save()
os.rename(filename, track)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment