Created
April 28, 2013 12:45
-
-
Save ddasilva/5476784 to your computer and use it in GitHub Desktop.
A script to print ID3 tags. (Backed up from ~/bin/print_id3).
Usage: print_id3 *.mp3
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/python | |
""" | |
Prints ID3 tag information about files. | |
Usage: print_id3 *.mp3 | |
""" | |
import sys | |
import os | |
from ID3 import ID3 | |
from termcolor import cprint | |
for arg in sys.argv[1:]: | |
cprint(arg, attrs=['bold']) | |
if not os.path.exists(arg): | |
cprint('File does not exist', 'red', attrs=['bold']) | |
continue | |
try: | |
tags = ID3(arg).as_dict() | |
except: | |
cprint('Error reading tags', 'red', attrs=['bold']) | |
continue | |
# Alright | |
for k, v in sorted(tags.items()): | |
cprint(k, 'green', end=': ') | |
print v | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment