div0 bug if we have frame errors at the video stream beginning

Thu, 30 Nov 2017 00:20:52 +0100

author
mdd
date
Thu, 30 Nov 2017 00:20:52 +0100
changeset 24
a1bc75496992
parent 23
9bf1a8d2c26e
child 25
078802773343

div0 bug if we have frame errors at the video stream beginning

ts2mkv.py file | annotate | diff | comparison | revisions
--- a/ts2mkv.py	Wed Nov 29 23:35:17 2017 +0100
+++ b/ts2mkv.py	Thu Nov 30 00:20:52 2017 +0100
@@ -76,6 +76,8 @@
                     percent = frame_number * 100.00 / frames_total
                     eta = frame_number / (time.time() - time_start)
                     # eta is frames per second so far
+                    if eta == 0:
+                        eta = 1
                     eta = (frames_total - frame_number) / eta / 60
                 sys.stdout.write("\rFrame %i of %i, %.1f%% done, ETA %.0f minutes, " % (
                     frame_number, frames_total, percent, eta
@@ -150,7 +152,7 @@
         if idx == -1:
             return ""
         idx += 8
-        self.info["msg_prepare"] += "Selecting: %s\n" % data
+        self.info["msg_prepare"] += "GetStreamIndex: %s\n" % data.strip()
         return data[idx:idx+3]
 
     def __get_movie_description(self):
@@ -241,10 +243,14 @@
         audio = filter_lines(audioall, "(eng):")
         aidx = self.get_stream_index(
             filter_lines(audio, "ac3"))
-        if aidx != "" and filter_lines(audio, "ac3").find(" 0 channels ") < 1:
-            # append english audio too!
-            print "Selecting english ac3 stream."
-            audiomap.append(aidx)
+        if aidx != "":
+            try:
+                filter_lines(audio, "ac3").index(" 0 channels")
+                print "Skipping english stream with 0 channels"
+            except ValueError:
+                # append english audio too!
+                print "Selecting english ac3 stream."
+                audiomap.append(aidx)
         if len(audiomap) == 0 and self.config["firstaudio"]:
             # append first audio stream as forced fallback
             aidx = self.get_stream_index(audioall)

mercurial