--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+mp3togo (0.5.5) unstable; urgency=low
+
+ * Added support for python-eyeD3 for more robust handling of unicode tags.
+ * python-ID3 is still supported and will be used if eyeD3 is not available.
+
+ -- Simeon Veldstra <reallifesim@gmail.com> Mon, 26 Jun 2006 19:17:31 -0700
+
+mp3togo (0.5.4) unstable; urgency=low
+
+ * Changed the ogg decoder to oggdec from ogg123 to fix bug on Debian Stable (Sarge).
+
+ -- Simeon Veldstra <reallifesim@gmail.com> Mon, 12 Jun 2006 19:46:05 -0700
+
mp3togo (0.5.3) unstable; urgency=low
* Added Justus Pendleton's patch to fix config file bug.
--- a/debian/control
+++ b/debian/control
@@ -2,12 +2,13 @@ Source: mp3togo
Section: sound
Priority: optional
Maintainer: Simeon Veldstra <reallifesim@gmail.com>
-Build-Depends: cdbs, debhelper (>= 4.2.0), python, docbook-to-man
-Standards-Version: 3.6.2
+Build-Depends: cdbs, debhelper (>= 4.2.0)
+Build-Depends-Indep: python, docbook-to-man
+Standards-Version: 3.7.2
Package: mp3togo
Architecture: all
-Depends: ${python:Depends}, python-pyvorbis, python-id3, mpg321, vorbis-tools
+Depends: ${python:Depends}, python-pyvorbis, python-eyeD3, mpg321, vorbis-tools
Recommends: flac, normalize-audio
Suggests: lame, python-xmms, faad
Description: A tool for loading music on to portable mp3 players
--- a/debian/mp3togo.1
+++ b/debian/mp3togo.1
@@ -134,4 +134,4 @@ License can be found in /usr/share/commo
.PP
mp3togo can be found online at http://puddle.ca/mp3togo
-.\" created by instant / docbook-to-man, Tue 06 Jun 2006, 19:24
+.\" created by instant / docbook-to-man, Mon 26 Jun 2006, 19:31
--- a/mp3togo/helpers.py
+++ b/mp3togo/helpers.py
@@ -76,6 +76,13 @@ def parse_mpg321(buf, f=frames()):
return f.frames/f.tframes * 100.0
return 0
+def parse_oggdec(buf):
+ s = buf.split('\r')
+ if len(s) == 2 and len(s[1]) == 9:
+ return float(s[1][2:7])
+ else:
+ return 0.0
+
def parse_oggenc(buf):
# From "jack"
s = buf.split('\r')
@@ -185,8 +192,13 @@ helpers = {
'type': 'wav',
'factor': 1,
'action': 'encode'},
- 'ogg123' : {'parser': parse_ogg123,
- 'cmd': 'ogg123 -d wav -f %o %i',
+# 'ogg123' : {'parser': parse_ogg123,
+# 'cmd': 'ogg123 -d wav -f %o %i',
+# 'type': 'ogg',
+# 'factor': 16.5,
+# 'action': 'decode'},
+ 'ogg123' : {'parser': parse_oggdec,
+ 'cmd': 'oggdec -o %o %i',
'type': 'ogg',
'factor': 16.5,
'action': 'decode'},
--- a/mp3togo/tags.py
+++ b/mp3togo/tags.py
@@ -35,12 +35,21 @@ else:
HAVE_VORBIS = True
try:
+ import eyeD3
+except ImportError:
+ HAVE_eyeD3 = False
+else:
+ HAVE_eyeD3 = True
+
+try:
import ID3
except ImportError:
HAVE_ID3 = False
else:
HAVE_ID3 = True
+import codecs
+
HAVE_METAFLAC=False
for path in os.environ['PATH'].split(':'):
if os.path.exists(os.path.join(path, 'metaflac')):
@@ -84,9 +93,18 @@ class Tags(UserDict.DictMixin):
return o
if self._type == 'mp3' and HAVE_ID3:
- info = ID3.ID3(self._file, as_tuple=1).as_dict()
- self._tags = copytags(info)
- del info
+ if HAVE_eyeD3:
+ eye = eyeD3.Tag()
+ eye.link(self._file)
+ self._tags['ARTIST'] = [eye.getArtist() or '']
+ self._tags['ALBUM'] = [eye.getAlbum() or '']
+ self._tags['TITLE'] = [eye.getTitle() or '']
+ self._tags['GENRE'] = [eye.getGenre().name or '']
+ del eye
+ elif HAVE_ID3:
+ info = ID3.ID3(self._file, as_tuple=1).as_dict()
+ self._tags = copytags(info)
+ del info
elif self._type == 'ogg' and HAVE_VORBIS:
info = ogg.vorbis.VorbisFile(self._file).comment().as_dict()
self._tags = copytags(info)
@@ -158,14 +176,31 @@ class Tags(UserDict.DictMixin):
del out
del vf
elif fmt == 'mp3':
- out = ID3.ID3(filename, as_tuple=1)
- puttags(out)
- try:
- out.write()
- except:
- # Tagging failed, but the file should be okay.
- pass
- del out
+ if HAVE_eyeD3:
+ out = eyeD3.Tag()
+ out.link(filename, eyeD3.ID3_V1)
+ out.setVersion(eyeD3.ID3_V1)
+ d = {}
+ d = puttags(d)
+ out.setArtist(d['ARTIST'])
+ out.setAlbum(d['ALBUM'])
+ out.setTitle(d['TITLE'])
+ g = eyeD3.Genre()
+ g.setId(d['GENRE'])
+ out.setGenre(g)
+ if d.has_key('COMMENT'):
+ out.addComment(d['COMMENT'])
+ out.update()
+ del out
+ elif HAVE_ID3:
+ out = ID3.ID3(filename, as_tuple=1)
+ puttags(out)
+ try:
+ out.write()
+ except:
+ # Tagging failed, but the file should be okay.
+ pass
+ del out
else:
self._lock.release()
raise setup.ErrorUnknownFileType
@@ -179,7 +214,7 @@ class Tags(UserDict.DictMixin):
return False
try:
- ifile = file(indexname, 'a')
+ ifile = codecs.open(indexname, 'a', 'utf-8')
ifile.write(filename + "\n")
keys = self._tags.keys()
keys.sort()
--- a/mp3togo/task.py
+++ b/mp3togo/task.py
@@ -42,13 +42,13 @@ DONE = 'done'
class SimpleTask:
"""Run a callable and save its output"""
- def __init__(self, parent, action, filter=None, reverse=None, tmpsize=0, outsize=0, name=''):
+ def __init__(self, parent, action, fltr=None, reverse=None, tmpsize=0, outsize=0, name=''):
if not action:
raise TypeError
if str(self.__class__).endswith('SimpleTask'):
if not callable(action):
raise TypeError
- for func in (filter, reverse):
+ for func in (fltr, reverse):
if func:
if not callable(func):
raise TypeError
@@ -58,7 +58,7 @@ class SimpleTask:
self.outsize = outsize
self._parent = parent
self._action = action
- self._filter = filter
+ self._filter = fltr
self._reverse = reverse
# Hold runlock while accessing self._status
self._runlock = threading.Lock()
@@ -266,7 +266,10 @@ class Task(SimpleTask):
try:
wpid, status = os.waitpid(pid, 0)
if os.WIFSIGNALED(status):
- self._status = FAILED
+ if os.WTERMSIG(status) == signal.SIGHUP:
+ self._status = FAILED
+ else:
+ self._status = FAILED
elif os.WEXITSTATUS(status) == 0:
self._status = DONE
else: