Add argparse
This commit is contained in:
parent
1a0a600fc7
commit
a2e274f798
@ -1,5 +1,5 @@
|
|||||||
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
@ -14,11 +14,28 @@ logging.basicConfig(
|
|||||||
format="%(asctime)s [%(levelname)s] %(message)s", level=logging.INFO
|
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__":
|
if __name__ == "__main__":
|
||||||
|
args = parse_args()
|
||||||
logging.info("Karaokatalog Deduplication started")
|
logging.info("Karaokatalog Deduplication started")
|
||||||
|
|
||||||
logging.info("Loading library")
|
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("Library loaded")
|
||||||
|
|
||||||
logging.info("Finding duplicates (songs with identical title and artist)")
|
logging.info("Finding duplicates (songs with identical title and artist)")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user