diff --git a/server/default_config.py b/server/default_config.py index bd5e0ba..8d923d6 100644 --- a/server/default_config.py +++ b/server/default_config.py @@ -6,3 +6,4 @@ DB_URI = 'sqlite:///techrec.db' AUDIO_OUTPUT = 'output/' AUDIO_INPUT = 'rec/' FORGE_TIMEOUT = 20 +FORGE_MAX_DURATION = 3600*5 diff --git a/server/server.py b/server/server.py index 06563b5..6987a37 100644 --- a/server/server.py +++ b/server/server.py @@ -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))