Esempio n. 1
0
def parseSyncArgs(args):
    from subsync.synchro import SyncTask, SubFile, RefFile, OutputFile, ChannelsMap

    sub = SubFile(path=args.sub)
    if args.sub_stream is not None:
        sub.select(args.sub_stream - 1)
    elif args.sub_stream_by_lang:
        sub.selectBy(lang=args.sub_stream_by_lang)
    sub.setNotNone(lang=args.sub_lang, enc=args.sub_enc, fps=args.sub_fps)

    ref = RefFile(path=args.ref)
    if args.ref_stream is not None:
        ref.select(args.ref_stream - 1)
    elif args.ref_stream_by_type or args.ref_stream_by_lang:
        ref.selectBy(type=args.ref_stream_by_type,
                     lang=args.ref_stream_by_lang)
    ref.setNotNone(lang=args.ref_lang, enc=args.ref_enc, fps=args.ref_fps)
    if args.ref_channels is not None:
        ref.channels = ChannelsMap.deserialize(args.ref_channels)

    out = args.out and OutputFile(
        path=args.out, fps=args.out_fps, enc=args.out_enc)
    task = SyncTask(sub, ref, out)
    settings().tasks = [task]
    return task
Esempio n. 2
0
def parseSyncArgs(args):
    from subsync.synchro import SyncTask, SubFile, RefFile, OutputFile, ChannelsMap

    sub = SubFile(path=args.sub)
    if args.sub_stream is not None:
        sub.select(args.sub_stream - 1)
    sub.setNotNone(lang=args.sub_lang, enc=args.sub_enc, fps=args.sub_fps)

    ref = RefFile(path=args.ref)
    if args.ref_stream is not None:
        ref.select(args.ref_stream - 1)
    ref.setNotNone(lang=args.ref_lang, enc=args.ref_enc, fps=args.ref_fps)
    if args.ref_channels is not None:
        ref.channels = ChannelsMap.deserialize(args.ref_channels)

    out = args.out and OutputFile(path=args.out, fps=args.out_fps, enc=args.out_enc)

    return SyncTask(sub, ref, out)