import argparse
import logging
from pathlib import Path

from unwind.imdb_import import download_datasets

log = logging.getLogger(__name__)

name = "download-imdb-dataset"
help = "Download IMDb datasets."


def add_args(cmd: argparse.ArgumentParser) -> None:
    cmd.add_argument("--basics", metavar="basics_file.tsv.gz", type=Path, required=True)
    cmd.add_argument(
        "--ratings", metavar="ratings_file.tsv.gz", type=Path, required=True
    )


async def main(args: argparse.Namespace) -> None:
    basics_path: Path = args.basics
    ratings_path: Path = args.ratings

    await download_datasets(basics_path=basics_path, ratings_path=ratings_path)
