27 lines
926 B
Python
27 lines
926 B
Python
import argparse
|
|
from os.path import realpath
|
|
from pathlib import Path
|
|
from transcode import Transcoder
|
|
from log import Log
|
|
|
|
def get_args():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('indir', type=Path, help='Directory containing artist directories')
|
|
parser.add_argument('outdir', type=Path, help='Empty directory where transcodes will be placed')
|
|
parser.add_argument('encoder', type=Path, help='Location of encoder')
|
|
return parser.parse_args()
|
|
|
|
|
|
def main(input_dir: Path, output_dir: Path, encoder: Path, out_extension: str = 'opus'):
|
|
wd = Path(realpath(__file__)).parent.parent
|
|
log_path = wd / "logs"
|
|
if encoder.parts[-1] == "qaac64.exe":
|
|
out_extension = "m4a"
|
|
transcoder = Transcoder(encoder, out_extension, input_dir, output_dir, log_path)
|
|
transcoder.transcode()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
args = get_args()
|
|
main(args.indir, args.outdir, args.encoder)
|