]> code.delx.au - webdl/commitdiff
Fix for avprobe python2
authorJames Bunton <jamesbunton@delx.net.au>
Thu, 9 Feb 2017 21:36:08 +0000 (08:36 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Thu, 9 Feb 2017 21:36:08 +0000 (08:36 +1100)
common.py

index 17c160df566648c7f841e107ffb5df82063ff1c8..ead72c645216692195eb2284c258e70ea29f0c30 100644 (file)
--- a/common.py
+++ b/common.py
@@ -219,7 +219,9 @@ def get_duration(filename):
     output = subprocess.check_output(cmd).decode("utf-8")
     for line in output.split("\n"):
         if line.startswith("duration="):
-            return float(line.split("=")[1])
+            return float(line.split("=")[1]) # ffprobe
+        if re.match(R'^[0-9.]*$', line):
+            return float(line) # avprobe
 
     raise Exception("Unable to determine video duration of " + filename)