]> git.0d.be Git - django-panik-emissions.git/commitdiff
add subsecond support to soxi fallback
authorFrédéric Péters <fpeters@0d.be>
Tue, 1 Sep 2020 13:23:42 +0000 (15:23 +0200)
committerFrédéric Péters <fpeters@0d.be>
Tue, 1 Sep 2020 13:23:42 +0000 (15:23 +0200)
emissions/utils.py

index c70c18492e7b1018e51574101a34c2737d49b8db..366d56760473777d04f61dc0a8f770e211f0dd6f 100644 (file)
@@ -30,10 +30,10 @@ def get_duration(filename):
         if not line.startswith('Duration'):
             continue
         try:
-            hours, minutes, seconds = re.findall(r'(\d\d):(\d\d):(\d\d)', line)[0]
+            hours, minutes, seconds, cs = re.findall(r'(\d\d):(\d\d):(\d\d)\.(\d\d)', line)[0]
         except IndexError:
             continue
-        return int(hours) * 3600 + int(minutes) * 60 + int(seconds)
+        return int(hours) * 3600 + int(minutes) * 60 + int(seconds) + (int(cs) / 100)
     return None