]> git.0d.be Git - pige-extractor.git/blobdiff - download.cgi
Changes to match nas.studio.priv recording layout
[pige-extractor.git] / download.cgi
index e271d0c75731946fc939f733307481821cbd4e76..7d04df7457a21566a5e409cf1c5b05850c6f707c 100755 (executable)
@@ -78,7 +78,8 @@ if ceil_end.minute%15:
     else:
         ceil_end = ceil_end.replace(minute=(1+(ceil_end.minute/15))*15)
 
-os.chdir(BASE_DIR)
+if type(BASE_DIR) is str:
+    os.chdir(BASE_DIR)
 
 def get_filenames():
     path = start.strftime(PATH_LAYOUT)
@@ -98,7 +99,15 @@ def get_filenames():
     return filenames
 
 while True:
-    filenames = get_filenames()
+    if type(BASE_DIR) is list:
+        filenames = []
+        for base_dir in BASE_DIR:
+            os.chdir(base_dir)
+            filenames.extend([os.path.join(base_dir, x) for x in get_filenames()])
+        filenames.sort()
+    else:
+        filenames = get_filenames()
+
     without_extension = [os.path.splitext(x)[0] for x in filenames]
     for f in without_extension:
         if without_extension.count(f) > 1:
@@ -128,14 +137,6 @@ 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: