]> git.0d.be Git - pige-extractor.git/commitdiff
added support for initial file not starting on a boundary
authorFrédéric Péters <fpeters@0d.be>
Wed, 7 Apr 2010 16:30:52 +0000 (18:30 +0200)
committerFrédéric Péters <fpeters@0d.be>
Wed, 7 Apr 2010 16:30:52 +0000 (18:30 +0200)
download.cgi

index ab4b6cd7edf76060461ee4fe1c96d8b9803bb52e..0a1da5d7175fb3496add57828d0b1381f2e14166 100755 (executable)
@@ -118,6 +118,14 @@ if ext == 'ogg':
 else:
     command = ['sox'] + filenames + ['-t', 'wav', '-']
 
+if filenames[0].endswith('.wav'):
+    # files get compressed after a while, and they lose their original creation
+    # time
+    creation_time = time.localtime(os.stat(filenames[0])[-3])
+    daytime_as_filename = '%02dh%02d' % creation_time[3:5]
+    if not (daytime_as_filename in filenames[0] and creation_time[5] == 0):
+        floor_start = datetime.datetime(*creation_time[:6])
+
 if start != floor_start or end != ceil_end:
     trim_parts = ['trim']
     if start != floor_start: