]> git.0d.be Git - pige-extractor.git/commitdiff
always pass trim values to sox
authorFrédéric Péters <fpeters@0d.be>
Sun, 15 May 2016 13:07:25 +0000 (15:07 +0200)
committerFrédéric Péters <fpeters@0d.be>
Sun, 15 May 2016 13:07:25 +0000 (15:07 +0200)
download.cgi

index 374d63fb230c3792d8a88335f9e7e7b14d3d1a66..be1812b2353102364de7a0b7bcd47457ef261cf8 100755 (executable)
@@ -138,24 +138,12 @@ if ext == 'ogg':
 else:
     command = ['sox'] + filenames + ['-t', 'wav', '-']
 
-if start != floor_start or end != ceil_end:
-    trim_parts = ['trim']
-    if start != floor_start:
-        trim_start = (start - floor_start).seconds
-        trim_parts.append(str(trim_start))
-    else:
-        trim_start = 0
-    if end != ceil_end:
-        if trim_start:
-            duration = (end - start).seconds
-            trim_parts.append(str(duration))
-        else:
-            trim_end = (ceil_end-end).seconds
-            trim_parts.append(str(trim_end))
-    command.extend(trim_parts)
+# trim
+command.append('trim')
+command.append('=%s' % (start - floor_start).seconds)
+command.append('=%s' % (end - floor_start).seconds)
 
 if '--test' in sys.argv:
     print ' '.join(command)
 else:
     os.system(' '.join(command))
-