From: Frédéric Péters Date: Wed, 3 Aug 2011 11:49:09 +0000 (+0200) Subject: Changes to match nas.studio.priv recording layout X-Git-Url: https://git.0d.be/?p=pige-extractor.git;a=commitdiff_plain;h=77b179c1403795902d984ab09c4398d053d5bfe8 Changes to match nas.studio.priv recording layout --- diff --git a/download.cgi b/download.cgi index e271d0c..7d04df7 100755 --- a/download.cgi +++ b/download.cgi @@ -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: