summaryrefslogtreecommitdiff
path: root/play.py
diff options
context:
space:
mode:
Diffstat (limited to 'play.py')
-rwxr-xr-xplay.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/play.py b/play.py
index 107c525..8f38cda 100755
--- a/play.py
+++ b/play.py
@@ -1135,6 +1135,21 @@ def get_tag(pathname):
import ID3
vc = ID3.ID3(pathname, as_tuple=1)
tags = vc.as_dict()
+ except ImportError:
+ try:
+ from pyid3lib import tag as ID3
+ vc = ID3(pathname)
+ tagtoframeid = {
+ 'ALBUM' : 'TALB', 'ARTIST' : 'TPE1', 'TITLE' : 'TIT2',
+ 'YEAR' : 'TYER', 'GENRE' : 'TCON', 'TRACKNUMBER' : 'TRCK'
+ }
+ for tag, fid in tagtoframeid.items():
+ try:
+ index = vc.index(fid)
+ tags[tag] = (vc[index]['text'],)
+ except ValueError:
+ tags[tag] = ("N/A",)
+ except: pass
except: return os.path.basename(pathname)
else:
return os.path.basename(pathname)