Added --update patch from Mark J. Hewitt v0.5.9

file:2ca72efcfa16067b1b702492ea07dabc47c0ff6f -> file:d3db1a26620b1dd04aad26ca3c83b433b366f383
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+mp3togo (0.5.9) unstable; urgency=low
+
+ * Added -u update switch for conditional --force. Thanks Mark J. Hewitt.
+
+ -- Simeon Veldstra <reallifesim@gmail.com> Sun, 4 Feb 2007 16:38:54 -0800
+
mp3togo (0.5.8) unstable; urgency=low
* Fixed failure when converting flac with no GENRE tag
file:7d59281fcbccb4c5833ce21b27b7951e41572f91 -> file:9de10c6c87670c0805d601688052ed070afccae4
--- 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 05 Nov 2006, 16:36
+.\" created by instant / docbook-to-man, Sun 04 Feb 2007, 16:42
file:deff07d815cc4550f27c8928a778b1ef73718ef5 -> file:25aaffbfb799c4b143a2a204e0093ed0ca00253b
--- a/mp3togo/__init__.py
+++ b/mp3togo/__init__.py
@@ -21,5 +21,5 @@
# __all__ = ('converter', 'main', 'options', 'setup')
-version = '0.5.8'
+version = '0.5.9'
file:eaf9ed86b31108888575599e00ea0751f8239c50 -> file:4ec6814c38ddeb1b4382ee34fc7a84c88bf63526
--- a/mp3togo/conf.py
+++ b/mp3togo/conf.py
@@ -98,6 +98,8 @@ class Options(options.Options):
('maxtempsize', '', '', 0L, None, ''),
('force', 'F', 'force', False, None,
'''Overwrite files if they already exist.'''),
+ ('update', 'u', 'update', False, None,
+ '''Overwrite files if they already exist only if they are older than the source file.'''),
('encoder', 'C', 'encoder', 'lame', None,
'''The encoder to use to create the output files. Options are wav, lame or oggenc.'''),
('encopts', 'E', 'encoder-options', '', None,
file:c4ca309cf270602b0ecc8790ddd427120124cbf0 -> file:8d11771cb378db48717ed907b58b1ac27451ec70
--- a/mp3togo/track.py
+++ b/mp3togo/track.py
@@ -252,16 +252,42 @@ 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)
- if self._hash and self._cache:
- self._cache.release(self._hash)
- for tsk in self._queue:
- tsk._status = task.DONE
- self._state = DONE
- return
+ ## 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)
+ # if self._hash and self._cache:
+ # self._cache.release(self._hash)
+ # for tsk in self._queue:
+ # tsk._status = task.DONE
+ # self._state = DONE
+ # return
+ if not opts['force']:
+ if os.path.exists(self._outname):
+ # In update mode, consider the track done if an existing file is older than the source
+ if opts['update']:
+ sourceinfo = os.stat(self._filename)
+ targetinfo = os.stat(self._outname)
+ if targetinfo.st_mtime >= sourceinfo.st_mtime:
+ opts.log(1, "Skipping up to date file: %s\n" % self._outname)
+ self._queue = tuple(tasks)
+ if self._hash and self._cache:
+ self._cache.release(self._hash)
+ for tsk in self._queue:
+ tsk._status = task.DONE
+ self._state = DONE
+ return
+ else:
+ opts.log(1, "Replacing out of date file: %s\n" % self._outname)
+ else: # Consider the track done if the output file exists:
+ opts.log(1, "Skipping existing file: %s\n" % self._outname)
+ self._queue = tuple(tasks)
+ if self._hash and self._cache:
+ self._cache.release(self._hash)
+ for tsk in self._queue:
+ tsk._status = task.DONE
+ self._state = DONE
+ return
# Ready to go
self._queue = tuple(tasks)
@@ -285,4 +311,3 @@ class Track:
child._parent = None
self._queue = ()
-