Added .m4a patch from Justus Pendleton.
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+mp3togo (0.5.2) unstable; urgency=low
+
+ * Added Justus Pendleton's .m4a patch
+
+ -- Simeon Veldstra <reallifesim@gmail.com> Wed, 31 May 2006 18:00:03 -0700
+
mp3togo (0.5.1) unstable; urgency=low
* Added --no-tags option which disables tagging of output files.
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Package: mp3togo
Architecture: all
Depends: ${python:Depends}, python-pyvorbis, python-id3, mpg321, vorbis-tools
Recommends: flac, normalize-audio
-Suggests: lame, python-xmms
+Suggests: lame, python-xmms, faad
Description: A tool for loading music on to portable mp3 players
A tool for creating sets of mp3 (or ogg vorbis) files
from an archive of music in various formats and bitrates.
--- 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, Sun 28 May 2006, 11:16
+.\" created by instant / docbook-to-man, Wed 31 May 2006, 18:03
--- a/mp3togo/__init__.py
+++ b/mp3togo/__init__.py
@@ -21,5 +21,5 @@
# __all__ = ('converter', 'main', 'options', 'setup')
-version = '0.5.1'
+version = '0.5.2'
--- a/mp3togo/conf.py
+++ b/mp3togo/conf.py
@@ -137,6 +137,7 @@ class Options(options.Options):
self.bin['mpg321'] = False
self.bin['ogg123'] = False
self.bin['flac'] = False
+ self.bin['faad'] = False
self.bin['metaflac'] = False
self.bin['normalize-audio'] = False
self.bin['dcop'] = False
@@ -152,7 +153,7 @@ Description:
mp3 player or an mp3 CD. The files to convert can be
specified in a playlist file (m3u, pls and plain text are
supported) or given as arguments to the program. mp3togo
- will go through the list and run mpg321, ogg123, flac and
+ will go through the list and run mpg321, ogg123, flac, faad and
lame to decode and reencode the files. The newly encoded
files will be written to the destination directory. The
software can retain as much of the subdirectory structure
@@ -238,7 +239,7 @@ def getfiletype(filename):
"""Return the format of an audio file"""
# Could use some more magic here
ft = os.path.splitext(filename)[1][1:]
- if ft not in ('mp3', 'ogg', 'flac', 'wav'):
+ if ft not in ('mp3', 'ogg', 'flac', 'wav', 'm4a'):
raise ErrorUnknownFileType
return ft
--- a/mp3togo/helpers.py
+++ b/mp3togo/helpers.py
@@ -140,6 +140,21 @@ def recode_wav(input, output, args=None)
input to output. Throws OSError on error."""
return lambda: shutil.copyfile(input, output)
+def parse_m4a_dec(buf):
+ n = buf.find('% decoding')
+ # if n==1 then we are at single digit progress (i.e. 5%) and
+ # at the beginning of the buffer
+ if n == 1:
+ s = buf[0]
+ # else we are somewhere deeper in the buffer...check if we are at
+ # single or double digit progress by looking two characters back
+ elif buf[n-2] == '\n':
+ s = buf[n-1:n]
+ else:
+ s = buf[n-2:n]
+ return int(s)
+
+
## Command line escape sequences:
#
# escape: for:
@@ -178,6 +193,10 @@ helpers = {
'cmd': 'flac --decode -F -o %o %i',
'type': 'flac',
'action': 'decode'},
+ 'm4a_dec':{'parser': parse_m4a_dec,
+ 'cmd': 'faad -o %o %i',
+ 'type': 'm4a',
+ 'action': 'decode'},
'wav_dec': {'parser': None,
'cmd': recode_wav,
'type': 'wav',
@@ -221,5 +240,5 @@ def make_args(helper, input, output, arg
def est_decoded_size(filename):
# This could be much better
tp = conf.getfiletype(filename)
- factors = {'mp3': 16.5, 'ogg': 16.5, 'flac': 2.8, 'wav': 1}
+ factors = {'mp3': 16.5, 'ogg': 16.5, 'flac': 2.8, 'wav': 1, 'm4a': 16.5}
return os.stat(filename).st_size * factors[tp]