ts2mkv.py

changeset 24
a1bc75496992
parent 20
5b433bdd2023
child 25
078802773343
equal deleted inserted replaced
23:9bf1a8d2c26e 24:a1bc75496992
74 frame_number = int(thread.match.group(1)) 74 frame_number = int(thread.match.group(1))
75 if frames_total > 0: 75 if frames_total > 0:
76 percent = frame_number * 100.00 / frames_total 76 percent = frame_number * 100.00 / frames_total
77 eta = frame_number / (time.time() - time_start) 77 eta = frame_number / (time.time() - time_start)
78 # eta is frames per second so far 78 # eta is frames per second so far
79 if eta == 0:
80 eta = 1
79 eta = (frames_total - frame_number) / eta / 60 81 eta = (frames_total - frame_number) / eta / 60
80 sys.stdout.write("\rFrame %i of %i, %.1f%% done, ETA %.0f minutes, " % ( 82 sys.stdout.write("\rFrame %i of %i, %.1f%% done, ETA %.0f minutes, " % (
81 frame_number, frames_total, percent, eta 83 frame_number, frames_total, percent, eta
82 )) 84 ))
83 except ValueError: 85 except ValueError:
148 """ 150 """
149 idx = data.find("Stream #") 151 idx = data.find("Stream #")
150 if idx == -1: 152 if idx == -1:
151 return "" 153 return ""
152 idx += 8 154 idx += 8
153 self.info["msg_prepare"] += "Selecting: %s\n" % data 155 self.info["msg_prepare"] += "GetStreamIndex: %s\n" % data.strip()
154 return data[idx:idx+3] 156 return data[idx:idx+3]
155 157
156 def __get_movie_description(self): 158 def __get_movie_description(self):
157 """ 159 """
158 looks for eit file with same basename of current filename 160 looks for eit file with same basename of current filename
239 audiomap.append(aidx) 241 audiomap.append(aidx)
240 242
241 audio = filter_lines(audioall, "(eng):") 243 audio = filter_lines(audioall, "(eng):")
242 aidx = self.get_stream_index( 244 aidx = self.get_stream_index(
243 filter_lines(audio, "ac3")) 245 filter_lines(audio, "ac3"))
244 if aidx != "" and filter_lines(audio, "ac3").find(" 0 channels ") < 1: 246 if aidx != "":
245 # append english audio too! 247 try:
246 print "Selecting english ac3 stream." 248 filter_lines(audio, "ac3").index(" 0 channels")
247 audiomap.append(aidx) 249 print "Skipping english stream with 0 channels"
250 except ValueError:
251 # append english audio too!
252 print "Selecting english ac3 stream."
253 audiomap.append(aidx)
248 if len(audiomap) == 0 and self.config["firstaudio"]: 254 if len(audiomap) == 0 and self.config["firstaudio"]:
249 # append first audio stream as forced fallback 255 # append first audio stream as forced fallback
250 aidx = self.get_stream_index(audioall) 256 aidx = self.get_stream_index(audioall)
251 if aidx != "": 257 if aidx != "":
252 print "Forcing first found audio stream: %s" % aidx 258 print "Forcing first found audio stream: %s" % aidx

mercurial