End time available in audio output filename

This commit is contained in:
boyska 2015-05-04 14:00:43 +02:00
parent 79f6f7574d
commit 190e4364c8
2 changed files with 5 additions and 2 deletions

View file

@ -15,7 +15,7 @@ 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.mp3'
AUDIO_OUTPUT_FORMAT = 'techrec-%(startdt)s-%(endtime)s-%(name)s.mp3'
FORGE_TIMEOUT = 20
FORGE_MAX_DURATION = 3600*5
FFMPEG_OUT_CODEC = ['-acodec', 'copy']

View file

@ -161,7 +161,10 @@ class RecAPI(Bottle):
(rec.endtime - rec.starttime).total_seconds()
}
rec.filename = get_config()['AUDIO_OUTPUT_FORMAT'] % {
'time': rec.starttime.strftime('%y%m%d_%H%M'),
'time': rec.starttime.strftime('%y%m%d_%H%M'), # kept for retrocompatibility, should be dropped
'startdt': rec.starttime.strftime('%y%m%d_%H%M'),
'enddt': rec.endtime.strftime('%y%m%d_%H%M'),
'endtime': rec.endtime.strftime('%H%M'),
'name': filter(lambda c: c.isalpha(), rec.name)
}
self.db.get_session(rec).commit()