# HG changeset patch # User mdd # Date 1511974832 -3600 # Node ID 5b433bdd2023ef7ff9c64e5794438fa67bfcd9f6 # Parent 3a9fd72717df1aaf27d3055860ac68d5e445e7e2 force first audio stream option diff -r 3a9fd72717df -r 5b433bdd2023 ts2mkv.py --- a/ts2mkv.py Tue Nov 28 22:49:41 2017 +0100 +++ b/ts2mkv.py Wed Nov 29 18:00:32 2017 +0100 @@ -245,6 +245,12 @@ # 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) + if aidx != "": + print "Forcing first found audio stream: %s" % aidx + audiomap.append(aidx) return audiomap def __parse_info(self): @@ -428,6 +434,8 @@ """ if not self.command: return None + if not self.info["msg_eit"]: + self.info["msg_eit"] = "No EIT file found, sorry - no description" fd = open(self.outfilebase + ".txt", "wb") fd.write(self.info["msg_eit"]) fd.write("\n\n# ---DEBUG---\n\n") @@ -460,12 +468,15 @@ help='one or more files, glob style syntax') parser.add_argument('-f', action='store_true', default=False, \ help='force overwrite of existing file') + parser.add_argument('--fa', action='store_true', default=False, \ + help='use first audio stream found') args = parser.parse_args() processor = ts2mkv(crf=args.crf, tune=args.tune) processor.config["scaledown"] = not args.ns processor.config["rename"] = args.rename processor.config["overwrite"] = args.f + processor.config["firstaudio"] = args.fa for srcstr in args.input: src = glob.glob(srcstr)