summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2011-03-30 02:01:42 (GMT)
committerAdrian C. (anrxc) <anrxc@sysphere.org>2011-03-30 02:01:42 (GMT)
commit57cd50ead63b7bda9d03b08139e7ac63557d8700 (patch)
tree6efb1a32121d1b726c18bd62b8f520f12e0c2163
parenta29a8a9243e01d3fca67c4b3eb3dfb3ecdeb71e7 (diff)
downloadplay-57cd50ead63b7bda9d03b08139e7ac63557d8700.tar.xz
play: add pyid3lib support as alternative for MP3 tags
-rw-r--r--README14
-rwxr-xr-xplay.py15
2 files changed, 22 insertions, 7 deletions
diff --git a/README b/README
index f4d2d77..27fbcd6 100644
--- a/README
+++ b/README
@@ -15,9 +15,11 @@ Usage:
Miscellaneous:
In order for either mp3info (ID3) or ogginfo to work, both
- corresponding python modules have to be installed. However,
- quick support for MP3 tags can be added by getting 'ID3.py'
- from the id3-py project: http://id3-py.sourceforge.net/
+ corresponding python modules have to be installed. Quickest
+ support for MP3 tags can be added by getting 'ID3.py' from the
+ id3-py project: http://id3-py.sourceforge.net or by installing
+ the (much more popular) 'pyid3lib' package provided by your OS
+ distribution.
A playlist can contain URLs, but the playlist itself will have
to be local. For mpeg streaming splay is recommended.
@@ -34,7 +36,5 @@ Authors:
forked. This exceptional software, originally written by Ulf
Betlehem, should not be forgotten.
- In March of 2011 a cplay branch was found on GitHub, published
- by Tomi Pievilainen, with some interesting patches on top of
- the original cplay. Very much like play includes. From this
- code MPlayer support was added to play.
+ MPlayer support was added to play from the excellent work done
+ by Tom Adams and Tomi Pievilainen on GitHub.com.
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)