summaryrefslogtreecommitdiff
path: root/recode.py
diff options
context:
space:
mode:
Diffstat (limited to 'recode.py')
-rw-r--r--recode.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/recode.py b/recode.py
index e67328e..a3cf8c3 100644
--- a/recode.py
+++ b/recode.py
@@ -35,12 +35,11 @@ class FFmpeg(Decoder):
def decode(self, source, dest, *args, **kwargs):
cmd = 'ffmpeg -loglevel quiet'.split()
- if 'start_time' in kwargs:
+ if 'start_time' in kwargs and kwargs['start_time']:
cmd += ['-ss', str(kwargs['start_time'])]
if 'end_time' in kwargs and kwargs['end_time']:
cmd += ['-t', str(kwargs['end_time'] - kwargs['start_time'])]
cmd += ['-i', source, '-y', dest]
- #cmd = (x.format(infile = source, outfile = dest) for x in 'ffmpeg -loglevel quiet -i {infile} -y {outfile}'.split())
p = subprocess.Popen(cmd, stderr = subprocess.PIPE, close_fds = True)
p.stderr.close()
p.wait()
@@ -62,7 +61,7 @@ class Recoder(object):
if self.decoder.__class__ == self.encoder.__class__ and hasattr(self.decoder, 'recode'):
self.decoder.recode(source, dest)
else:
- with tempfile.NamedTemporaryFile(mode = 'wb', prefix = 'foo', suffix = '.wav', delete = True) as temp:
+ with tempfile.NamedTemporaryFile(mode = 'wb', prefix = 'ongaku-', suffix = '.wav', delete = True) as temp:
self.decoder.decode(source, temp.name, **kwargs)
self.encoder.encode(temp.name, dest, **kwargs)