diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-08-23 13:54:59 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-08-23 13:54:59 +0200 |
commit | 2c49a03494ec2cebf2c820efb257c950f170face (patch) | |
tree | dabb8de9886cfdef13fc97f2c3dd0eb226d7b79d /recode.py | |
parent | 07518d34d676df41bf2259cf66ba92444673c810 (diff) |
Read tracks and directories from the database.
Diffstat (limited to 'recode.py')
-rw-r--r-- | recode.py | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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) |