compare with and output to separate directories

This commit is contained in:
George Lacey 2025-07-18 22:12:41 +01:00
parent bde4972a7f
commit ac10071990

View File

@ -8,21 +8,22 @@ from layers import Dedupe, Transcoder
def get_args(): def get_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('indir', type=Path, help='Directory containing artist directories') parser.add_argument('indir', type=Path, help='Directory containing artist directories')
parser.add_argument('compdir', type=Path, help='Directory to compare input')
parser.add_argument('outdir', type=Path, help='Empty directory where transcodes will be placed') parser.add_argument('outdir', type=Path, help='Empty directory where transcodes will be placed')
parser.add_argument('encoder', type=Path, help='Location of encoder') parser.add_argument('encoder', type=Path, help='Location of encoder')
return parser.parse_args() return parser.parse_args()
def main(input_dir: Path, output_dir: Path, encoder: Path, out_extension: str = 'opus'): def main(input_dir: Path, compare_dir: Path, output_dir: Path, encoder: Path, out_extension: str = 'opus'):
wd = Path(realpath(__file__)).parent.parent wd = Path(realpath(__file__)).parent.parent
log_path = wd / "logs" log_path = wd / "logs"
if encoder.parts[-1] == "qaac64.exe": if encoder.parts[-1] == "qaac64.exe":
out_extension = "m4a" out_extension = "m4a"
log = Log(log_path) log = Log(log_path)
input_root = Root(input_dir, log) input_root = Root(input_dir, log)
output_root = Root(output_dir, log) compdir_root = Root(compare_dir, log)
dedupe = Dedupe(output_root, log) dedupe = Dedupe(compdir_root, log)
dedupe.process(input_root) dedupe.process(input_root)
transcoder = Transcoder(encoder, out_extension, output_dir, log, log_path) transcoder = Transcoder(encoder, out_extension, output_dir, log, log_path)
@ -32,4 +33,4 @@ def main(input_dir: Path, output_dir: Path, encoder: Path, out_extension: str =
if __name__ == '__main__': if __name__ == '__main__':
args = get_args() args = get_args()
main(args.indir, args.outdir, args.encoder) main(args.indir, args.compdir, args.outdir, args.encoder)