From 48e39a979ab1ba7eab7dd7967dd6c8abbd14bba2 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Wed, 20 Nov 2024 15:57:43 -0500 Subject: [PATCH] Remove old directors script populate-directors is the replacement. --- pyproject.toml | 3 --- src/letsrolld/cmd/directors.py | 48 ---------------------------------- 2 files changed, 51 deletions(-) delete mode 100644 src/letsrolld/cmd/directors.py diff --git a/pyproject.toml b/pyproject.toml index f076d86..ab63ee1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,9 +44,6 @@ build-backend = "pdm.backend" distribution = true [project.scripts] -# TODO: remove this obsolete script -directors = "letsrolld.cmd.directors:main" - populate-directors = "letsrolld.cmd.populate_directors:main" update-directors = "letsrolld.cmd.update:directors_main" update-films = "letsrolld.cmd.update:films_main" diff --git a/src/letsrolld/cmd/directors.py b/src/letsrolld/cmd/directors.py deleted file mode 100644 index c55753c..0000000 --- a/src/letsrolld/cmd/directors.py +++ /dev/null @@ -1,48 +0,0 @@ -import argparse -import csv - -from letsrolld import http -from letsrolld import director -from letsrolld import filmlist - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument( - "-D", "--debug", help="enable debug logging", action="store_true" - ) - parser.add_argument("-i", "--input", help="input movie list file", required=True) - parser.add_argument( - "-o", "--output", help="output director list file", required=True - ) - parser.add_argument( - "-a", "--append", action="store_true", help="append to output file" - ) - args = parser.parse_args() - - if args.debug: - http.enable_debug() - - film_list = list(filmlist.read_film_list(args.input)) - - director_list = [] - if args.append is not None: - with open(args.output, "r") as csvfile: - reader = csv.reader(csvfile) - next(reader) # skip header - director_list = [row[0] for row in reader] - - mode = "w" if args.append is None else "a" - with open(args.output, mode, newline="") as csvfile: - writer = csv.writer(csvfile) - if args.append is None: - writer.writerow(["Name", "Letterboxd URI"]) - - for i, director_ in enumerate( - director.get_directors_by_films(film_list), start=1 - ): - if director_.name in director_list: - continue - print(f"Processing director #{i}: {director_.name}") - writer.writerow([director_.name, director_.base_url]) - csvfile.flush()