Created
April 19, 2011 05:51
-
-
Save feltnerm/926884 to your computer and use it in GitHub Desktop.
display simple tracklist info about a directory of mp3s
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 | |
""" | |
audinf.py | |
Displays simple track info about a list of mp3s | |
""" | |
import sys | |
import os | |
from mutagen.easyid3 import EasyID3 as eid3 | |
def print_tags(f): | |
audio = eid3(f) | |
try: | |
artist = audio['artist'][0] | |
title = audio['title'][0] | |
print "%s - %s" % (artist, title) | |
except KeyError: | |
print f | |
def main(): | |
cwd = os.getcwd() | |
for p,n,files in os.walk(cwd): | |
print 'Found %s files.' % len(files) | |
for f in files: | |
if ('.mp3' or '.flac' or '.mp4' or '.aac' or '.ogg' or '.m4a') in f: | |
print_tags(f) | |
return 0 # success ! | |
if __name__ == "__main__": | |
status = main() | |
sys.exit(status) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment