243 filter_lines(audio, "ac3")) |
243 filter_lines(audio, "ac3")) |
244 if aidx != "" and filter_lines(audio, "ac3").find(" 0 channels ") < 1: |
244 if aidx != "" and filter_lines(audio, "ac3").find(" 0 channels ") < 1: |
245 # append english audio too! |
245 # append english audio too! |
246 print "Selecting english ac3 stream." |
246 print "Selecting english ac3 stream." |
247 audiomap.append(aidx) |
247 audiomap.append(aidx) |
|
248 if len(audiomap) == 0 and self.config["firstaudio"]: |
|
249 # append first audio stream as forced fallback |
|
250 aidx = self.get_stream_index(audioall) |
|
251 if aidx != "": |
|
252 print "Forcing first found audio stream: %s" % aidx |
|
253 audiomap.append(aidx) |
248 return audiomap |
254 return audiomap |
249 |
255 |
250 def __parse_info(self): |
256 def __parse_info(self): |
251 """ |
257 """ |
252 get total duration and fps from input stream |
258 get total duration and fps from input stream |
426 requires successful load as first step |
432 requires successful load as first step |
427 returns ffmpeg conversion exit status |
433 returns ffmpeg conversion exit status |
428 """ |
434 """ |
429 if not self.command: |
435 if not self.command: |
430 return None |
436 return None |
|
437 if not self.info["msg_eit"]: |
|
438 self.info["msg_eit"] = "No EIT file found, sorry - no description" |
431 fd = open(self.outfilebase + ".txt", "wb") |
439 fd = open(self.outfilebase + ".txt", "wb") |
432 fd.write(self.info["msg_eit"]) |
440 fd.write(self.info["msg_eit"]) |
433 fd.write("\n\n# ---DEBUG---\n\n") |
441 fd.write("\n\n# ---DEBUG---\n\n") |
434 fd.write(self.info["msg_prepare"]) |
442 fd.write(self.info["msg_prepare"]) |
435 fd.write(self.info["msg_ffmpeg"]) |
443 fd.write(self.info["msg_ffmpeg"]) |
458 help='rename file basename to name and genre from EIT file if present') |
466 help='rename file basename to name and genre from EIT file if present') |
459 parser.add_argument('input', metavar='input', nargs='+', \ |
467 parser.add_argument('input', metavar='input', nargs='+', \ |
460 help='one or more files, glob style syntax') |
468 help='one or more files, glob style syntax') |
461 parser.add_argument('-f', action='store_true', default=False, \ |
469 parser.add_argument('-f', action='store_true', default=False, \ |
462 help='force overwrite of existing file') |
470 help='force overwrite of existing file') |
|
471 parser.add_argument('--fa', action='store_true', default=False, \ |
|
472 help='use first audio stream found') |
463 |
473 |
464 args = parser.parse_args() |
474 args = parser.parse_args() |
465 processor = ts2mkv(crf=args.crf, tune=args.tune) |
475 processor = ts2mkv(crf=args.crf, tune=args.tune) |
466 processor.config["scaledown"] = not args.ns |
476 processor.config["scaledown"] = not args.ns |
467 processor.config["rename"] = args.rename |
477 processor.config["rename"] = args.rename |
468 processor.config["overwrite"] = args.f |
478 processor.config["overwrite"] = args.f |
|
479 processor.config["firstaudio"] = args.fa |
469 |
480 |
470 for srcstr in args.input: |
481 for srcstr in args.input: |
471 src = glob.glob(srcstr) |
482 src = glob.glob(srcstr) |
472 for srcfile in src: |
483 for srcfile in src: |
473 print "Processing: %s" % srcfile |
484 print "Processing: %s" % srcfile |