예제 #1
0
def check_chaptered(p_queue: Queue):
    """check"""
    while p_queue.empty() is False:
        original_file: Path = p_queue.get()
        try:
            mkv = mkvfile.MkvFile(original_file)
            if mkv.chaptered is False:
                print(f"{original_file}")
        except:
            print(f"ERROR PARSING :::: {original_file}")
        p_queue.task_done()
예제 #2
0
def check_subs(p_queue: Queue):
    """check"""
    while p_queue.empty() is False:
        original_file: Path = p_queue.get()
        try:
            mkv = mkvfile.MkvFile(original_file)
            for track in mkv.tracks:
                if track.codec == "substationalpha":
                    print(f"{original_file}")
        except:
            print(f"ERROR PARSING :::: {original_file}")
        p_queue.task_done()
예제 #3
0
                        default="und",
                        help="Lang of the video track")
    parser.add_argument("-r",
                        "--repl",
                        dest="repl",
                        type=str,
                        default="",
                        help="Pattern to replace for the Title")
    args = parser.parse_args()

    # Get a list of files
    files = common.list_directory(args.input.resolve(),
                                  lambda x: x.suffix == ".mkv", True)

    for f in files:
        mkv = mkvfile.MkvFile(f)
        cmd = f'mkvpropedit {quote(str(f))}'

        # Handle subtitles tracks
        stracks = list(filter(lambda x: x.type == "subtitles", mkv.tracks))
        sub_langs = args.sub_lang.split(",")
        sub_names = args.sub_name.split(",") if args.sub_name else []
        tid = 1
        for track in stracks:
            if tid <= len(sub_langs):
                sl = sub_langs[tid - 1]
            else:
                sl = "und"
            sn = f'{sl.upper()}'
            forced = False
            if tid <= len(sub_names):
예제 #4
0
    parser.add_argument(
        "-t",
        "--subtitles-types",
        dest="subtitles_types",
        type=str,
        default="ass,srt",
        help="Subtitles types to extract [all,ass,pgs,srt, comma separated]")
    args = parser.parse_args()
    LOGGER = logger.Logger(args.verbose)

    # Sanity checks
    common.ensure_exist(["mkvmerge", "mkvextract"])
    if args.input.exists() is False:
        common.abort(parser.format_help())

    mkv = mkvfile.MkvFile(args.input)
    if mkv.is_valid is False:
        common.abort(
            f"{common.COLOR_RED}[!] ERROR: Invalid mkv file {common.COLOR_WHITE}{args.input}"
        )

    # Only tracks type we want
    allowed_track_types = list()
    if args.videos is True:
        allowed_track_types.append("video")
    if args.audios is True:
        allowed_track_types.append("audio")
    if args.subtitles is True:
        allowed_track_types.append("subtitles")

    # Only langs we want