Add argparse

This commit is contained in:
Jakob Moser 2025-05-22 10:47:07 +02:00
parent 1a0a600fc7
commit a2e274f798
Signed by: jakob
GPG Key ID: 3EF2BA2851B3F53C

View File

@ -1,5 +1,5 @@
import argparse
import logging
import sys
from pathlib import Path
from tqdm import tqdm
@ -14,11 +14,28 @@ logging.basicConfig(
format="%(asctime)s [%(levelname)s] %(message)s", level=logging.INFO
)
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
prog="python3 -m karaokatalog.deduplicate",
description="Deduplicate UltraStar Deluxe song libraries",
)
parser.add_argument(
"library_path",
type=Path,
help="The directory which contains the songs, the one you'd also configure UltraStar Deluxe to use",
)
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
logging.info("Karaokatalog Deduplication started")
logging.info("Loading library")
library = Library.from_dir(Path(sys.argv[1]))
library = Library.from_dir(args.library_path)
logging.info("Library loaded")
logging.info("Finding duplicates (songs with identical title and artist)")