Avoid generation of enormously long recording
This commit is contained in:
parent
7e9aa219db
commit
f12124378f
2 changed files with 7 additions and 0 deletions
|
@ -6,3 +6,4 @@ DB_URI = 'sqlite:///techrec.db'
|
|||
AUDIO_OUTPUT = 'output/'
|
||||
AUDIO_INPUT = 'rec/'
|
||||
FORGE_TIMEOUT = 20
|
||||
FORGE_MAX_DURATION = 3600*5
|
||||
|
|
|
@ -143,6 +143,12 @@ class RecAPI(Bottle):
|
|||
rec.filename,
|
||||
'rec': rec
|
||||
}
|
||||
if get_config()['FORGE_MAX_DURATION'] > 0 and \
|
||||
(rec.endtime - rec.starttime).total_seconds() > \
|
||||
get_config()['FORGE_MAX_DURATION']:
|
||||
return {'status': 'error',
|
||||
'message': 'The requested recording is too long'
|
||||
}
|
||||
rec.filename = 'ror-%s-%s.mp3' % \
|
||||
(rec.starttime.strftime('%y%m%d_%H%M'),
|
||||
filter(lambda c: c.isalpha(), rec.name))
|
||||
|
|
Loading…
Reference in a new issue