Created
November 23, 2011 04:17
-
-
Save alexras/1387876 to your computer and use it in GitHub Desktop.
Quick-and-dirty script for tagging a bunch of MP3s based on title and artist data stored in a text file
This file contains 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 os | |
with open("names.txt", "r") as fp: | |
for file_num, line in enumerate(fp): | |
track_num = file_num + 1 | |
artist, sep, title = line.strip().partition('-') | |
artist = artist.strip() | |
title = title.strip() | |
os.system('id3tool --set-title="{title}" --set-artist="{artist}" ' | |
'--set-album="NC000" --set-track={track_num} ' | |
'{file_num}.mp3'.format(file_num=file_num, title=title, | |
artist=artist, track_num=track_num)) | |
os.system('cp {file_num}.mp3 "{artist} - {title}.mp3"'.format( | |
file_num=file_num, title=title, artist=artist, | |
track_num=track_num)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment