filename of input and output are customizable

the input filename can be customized, provided that the files still need
to be cut hourly
This commit is contained in:
boyska 2014-02-21 18:42:25 +01:00
parent 062f547b58
commit 6791d24a2c
3 changed files with 9 additions and 6 deletions

View file

@ -5,5 +5,7 @@ DEBUG = True
DB_URI = 'sqlite:///techrec.db'
AUDIO_OUTPUT = 'output/'
AUDIO_INPUT = 'rec/'
AUDIO_INPUT_FORMAT = '%Y-%m/%d/rec-%Y-%m-%d-%H-%M-%S.mp3'
AUDIO_OUTPUT_FORMAT = 'techrec-%(time)s-%(name)s'
FORGE_TIMEOUT = 20
FORGE_MAX_DURATION = 3600*5

View file

@ -13,9 +13,9 @@ def get_timefile_exact(time):
that work is done in get_timefile(time)
'''
return os.path.join(
get_config()['AUDIO_INPUT'],
time.strftime('%Y-%m/%d/rec-%Y-%m-%d-%H-%M-%S-ror.mp3')
)
get_config()['AUDIO_INPUT'],
time.strftime(get_config()['AUDIO_INPUT_FORMAT'])
)
def round_timefile(exact):

View file

@ -152,9 +152,10 @@ class RecAPI(Bottle):
' (%d seconds)' %
(rec.endtime - rec.starttime).total_seconds()
}
rec.filename = 'ror-%s-%s.mp3' % \
(rec.starttime.strftime('%y%m%d_%H%M'),
filter(lambda c: c.isalpha(), rec.name))
rec.filename = get_config()['AUDIO_OUTPUT_FORMAT'] % {
'time': rec.starttime.strftime('%y%m%d_%H%M'),
'name': filter(lambda c: c.isalpha(), rec.name)
}
self.db.update(rec.id, rec.serialize())
job_id = get_process_queue().submit(
create_mp3,