46 lines
1.2 KiB
Python
Executable File
46 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
||
|
||
import argparse
|
||
import convert_file_encoding
|
||
import split_flac
|
||
|
||
|
||
def create_convert_parser(subparsers):
|
||
parser = subparsers.add_parser(
|
||
"convert",
|
||
description="Recursively convert .cue and .log files from cp1251 to utf-8",
|
||
epilog="Example: python convert_encoding.py /path/to/directory",
|
||
)
|
||
parser.add_argument(
|
||
"--directory",
|
||
type=str,
|
||
help="Path to target directory for conversion",
|
||
default=".",
|
||
)
|
||
parser.set_defaults(func=convert_file_encoding.execute)
|
||
|
||
|
||
def create_split_parser(subparsers):
|
||
parser = subparsers.add_parser(
|
||
"split",
|
||
description="Разделение FLAC-файла по CUE с переносом оригинала во временную директорию",
|
||
)
|
||
parser.add_argument(
|
||
"--directory",
|
||
type=str,
|
||
help="Path to target directory with flac and cue files",
|
||
default=".",
|
||
)
|
||
parser.set_defaults(func=split_flac.execute)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
top_parser = argparse.ArgumentParser()
|
||
subparsers = top_parser.add_subparsers()
|
||
create_convert_parser(subparsers)
|
||
create_split_parser(subparsers)
|
||
|
||
args = top_parser.parse_args()
|
||
print(args)
|
||
args.func(args)
|