Browse Source

End time available in audio output filename

boyska 9 years ago
parent
commit
190e4364c8
2 changed files with 5 additions and 2 deletions
  1. 1 1
      server/default_config.py
  2. 4 1
      server/server.py

+ 1 - 1
server/default_config.py

@@ -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']

+ 4 - 1
server/server.py

@@ -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()