Version 0.3.1
Bug Fixes:
  * Thanks: Christopher Arndt for setup.py fix and suggestions.
  * Incorrect parameter in setup.py
  * Don't overwrite unless --force is used.
  * Don't mangle file names arbitrarily.
  * Separate the test suite.
  * Be graceful in the absence of third party modules.

-sim

file:a3bfa6f95101b92d740a17ec5d83e86cf7e9069c -> file:03382f66352b1a6df13810c751b4ca25793e2245
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+mp3togo (0.3.1) unstable; urgency=low
+
+ * Thanks: Christopher Arndt for setup.py fix and suggestions.
+ * Incorrect parameter in setup.py
+ * Don't overwrite unless --force is used.
+ * Don't mangle file names arbitrarily.
+ * Separate the test suite.
+ * Be graceful in the absence of third party modules.
+
+ -- Simeon Veldstra <reallifesim@gmail.com> Mon, 15 May 2006 18:56:48 -0700
+
mp3togo (0.3.0) unstable; urgency=low
* Rewrote program to use os.exec instead of os.system.
file:8c77441a752d69e4810cc549a26e737e3538fa2d -> file:ffafe2424e01902a87547c1aaca53bcb1dbcc0a9
--- 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 14 May 2006, 15:17
+.\" created by instant / docbook-to-man, Tue 16 May 2006, 13:17
file:073b7b7235b2f0437541a4a0c7c4dc4c9bb3c247 -> file:53c992da66949c9646cd910a1ca8fd8adf45d8b0
--- a/mp3togo/__init__.py
+++ b/mp3togo/__init__.py
@@ -21,5 +21,5 @@
# __all__ = ('converter', 'main', 'options', 'setup')
-version = '0.3.0'
+version = '0.3.1'
file:eaeaeb194b3aed21c1eea5bc9127d359e22a1b7c -> file:c9040b3e69fd58deff326afc4813331080caf881
--- a/mp3togo/conf.py
+++ b/mp3togo/conf.py
@@ -128,6 +128,18 @@ Description:
as desired.
"""
+ # Check for Third party modules:
+ for name in ('ogg.vorbis', 'ID3', 'xmms'):
+ try:
+ if '.' in name:
+ __import__(name, [], [], [name.split('.')[1]])
+ else:
+ __import__(name)
+ except ImportError:
+ msg = "Third party module: " + name
+ msg += "is not available. Doing without"
+ log(1, "Third party module: %s is not available. Doing without")
+
# Go ahead and read in the data:
self.getconf(argv, conffile, readconf)
@@ -198,8 +210,7 @@ Description:
def cleanfilename(self, name):
"""Remove nasty characters from a filename"""
- name = name.replace(' ', '_')
- name = name.replace('"', "")
+ name = name.replace('"', "'")
name = name.replace(':', '.')
name = name.replace("?", "")
name = name.replace('*', '')
file:d16ea42a99fe6886ffe73643ff4d7a2e9225db96 -> file:94c76392b31f99a8d13d78631f9663d965457e93
--- a/mp3togo/filelist.py
+++ b/mp3togo/filelist.py
@@ -64,7 +64,8 @@ class FileList:
except:
continue
- self._list.append(name)
+ if name not in self._list:
+ self._list.append(name)
self._lock.release()
return True
file:32dea4e252772e38185ab9d4e42beef43646c1be -> file:843492b28bcd01439c3894b34971dff830a95a9b
--- a/mp3togo/main.py
+++ b/mp3togo/main.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+### #!/usr/bin/python
# - main.py -
# This file is part of mp3togo
@@ -32,6 +32,7 @@ import time
import termios
import fcntl
+import mp3togo
import mp3togo.filelist as filelist
import mp3togo.conf as conf
import mp3togo.track as track
@@ -88,7 +89,7 @@ def main(argv):
def execute_sequential(playlist, opts):
"""Run the conversions one at a time"""
- print "mp3togo\n"
+ print "mp3togo %s\n" % mp3togo.version
print "<space> or 'p' to pause, <esc> or 'q' to quit\n"
c = ''
start_time = time.time()
@@ -97,7 +98,7 @@ def execute_sequential(playlist, opts):
playlist.run()
try:
-
+ # Terminal sushi
fd = sys.stdin.fileno()
oldterm = termios.tcgetattr(fd)
newattr = termios.tcgetattr(fd)
@@ -142,7 +143,7 @@ def execute_sequential(playlist, opts):
raise KeyboardInterrupt
elif c in (' ', 'p', 'P'):
if tsk.pause():
- sys.stdout.write("\r <PAUSED> ")
+ sys.stdout.write("\r [PAUSED] hit <enter> to resume ")
while 1:
try:
c = sys.stdin.read(1)
@@ -181,6 +182,9 @@ def execute_sequential(playlist, opts):
good_ones += 1
else:
bad_ones += 1
+ trk.close()
+ del trk
+
tt = time.time() - track_start
ts = format_time(tt)
if ts:
@@ -194,7 +198,7 @@ def execute_sequential(playlist, opts):
if bad_ones == 1:
bad_str = ", 1 track failed."
else:
- bad_str = ", %d tracks failed."
+ bad_str = ", %d tracks failed." % bad_ones
else:
bad_str = "."
#bytes = format_bytes(pl.produced_bytes)
@@ -202,7 +206,7 @@ def execute_sequential(playlist, opts):
(good_ones, bad_str, ts)
finally:
- # Restore the terminal:
+ # Fry some fish:
termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm)
fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)
file:c9a97c6c71ecd1379fe680eb3f163a2cd74483e3 -> file:ed553e0368bc74a27ba03b45d8ad4f065dc72728
--- a/mp3togo/tags.py
+++ b/mp3togo/tags.py
@@ -27,8 +27,19 @@ else:
import os, sys
import UserDict
-import ogg.vorbis
-import ID3
+try:
+ import ogg.vorbis
+except ImportError:
+ HAVE_VORBIS = False
+else:
+ HAVE_VORBIS = True
+
+try:
+ import ID3
+except ImportError:
+ HAVE_ID3 = False
+else:
+ HAVE_ID3 = True
HAVE_METAFLAC=False
for path in os.environ['PATH'].split(':'):
@@ -71,26 +82,26 @@ class Tags(UserDict.DictMixin):
o[k] = list(d[k])
return o
- if self._type == 'mp3':
+ if self._type == 'mp3' and HAVE_ID3:
info = ID3.ID3(self._file, as_tuple=1).as_dict()
self._tags = copytags(info)
del info
- elif self._type == 'ogg':
+ elif self._type == 'ogg' and HAVE_VORBIS:
info = ogg.vorbis.VorbisFile(self._file).comment().as_dict()
self._tags = copytags(info)
del info
- elif self._type == 'flac':
- if HAVE_METAFLAC:
- cmd = '%s --export-tags-to=- "%s" ' % ('metaflac', self._file)
- fd = os.popen(cmd)
- info = fd.read()
- fd.close()
- info = map(lambda x: x.split('=', 1), info.split('\n'))
- info = filter(lambda x: len(x) == 2, info)
- info = map(lambda x: [x[0].upper(), x[1:]], info)
- self._tags = dict(info)
+ elif self._type == 'flac' and HAVE_METAFLAC:
+ cmd = '%s --export-tags-to=- "%s" ' % ('metaflac', self._file)
+ fd = os.popen(cmd)
+ info = fd.read()
+ fd.close()
+ info = map(lambda x: x.split('=', 1), info.split('\n'))
+ info = filter(lambda x: len(x) == 2, info)
+ info = map(lambda x: [x[0].upper(), x[1:]], info)
+ self._tags = dict(info)
elif self._type == 'wav':
pass
+
# Try to guess from the file's path - better than nothing
path = os.path.splitext(self._file)[0]
file:99090b37cb27b8e6359e27801accd782d52b549c -> file:63ddcf60c23fabb7572882d97c67449f984b1bd6
--- a/mp3togo/track.py
+++ b/mp3togo/track.py
@@ -101,13 +101,9 @@ class Track:
dir = ''
self._outdir = os.path.join(opts['playerdir'], dir)
self._outname = os.path.join(self._outdir, base)
+ self._outname += '.' + helpers[opts['encoder']]['type']
self._wavname = os.path.join(opts['tempdir'], base) + '.wav'
- if os.path.exists(self._outname) and not opts['force']:
- opts.log(1, "Skipping existing file: %s\n" % self._outname)
- # Should throw an exception?
- return
-
def make_dirs():
if not os.path.isdir(self._outdir):
os.makedirs(self._outdir)
@@ -161,7 +157,6 @@ class Track:
# Encode
encoder = opts['encoder']
prog = helpers[encoder]
- self._outname += '.' + prog['type']
outreq = tmpreq / opts['compfactor']
jobname = "Encoding %s" % prog['type']
filter = prog['parser']
@@ -217,6 +212,15 @@ class Track:
tasks.append(job)
del job
+ # Consider the track done if the output file exists:
+ if os.path.exists(self._outname) and not opts['force']:
+ opts.log(1, "Skipping existing file: %s\n" % self._outname)
+ self._queue = tuple(tasks)
+ for tsk in self._queue:
+ tsk._status = task.DONE
+ self._state = DONE
+ return
+
# Ready to go
self._queue = tuple(tasks)
self._state = READY
file:bd05804c94c554cf979f16acb878bfe7748b396e -> file:29d606ebfcb9ecabd5b53c65f1b03fa8dcacba9a
--- a/setup.py
+++ b/setup.py
@@ -68,7 +68,8 @@ use its components in another program.
The package installs a command line executable named mp3togo
in /usr/bin, for command line options, run `mp3togo --help`.""",
packages = ["mp3togo"],
- data_files = [('/usr/bin', ['bin/mp3togo'])],
+ #data_files = [('/usr/bin', ['bin/mp3togo'])],
+ scripts = ['bin/mp3togo'],
classifiers = [
'Development Status :: 4 - Beta',
'Environment :: Console',