Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update directors.csv #162

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ test: lint
pdm run pytest

# One can use e.g. https://letterboxd.com/hershwin/list/all-the-movies/ as the base list
get-directors:
pdm run get-directors -i ./data/lists/everything.csv -o ${DIRECTORS_FILE} | $(RUN_LOG_CMD)
fetch-directors:
pdm run fetch-directors -i ./data/lists/everything.csv -o ${DIRECTORS_FILE} | $(RUN_LOG_CMD)

populate-directors:
pdm run populate-directors -d ${DIRECTORS_FILE}

# TODO: add dump-directors to run-all?
dump-directors:
pdm run dump-directors -o ${DIRECTORS_FILE}.new | $(RUN_LOG_CMD)
mv ${DIRECTORS_FILE}.new ${DIRECTORS_FILE}
Expand All @@ -42,7 +41,7 @@ run-update-services:
run-cleanup:
pdm run cleanup $(ARGS) | $(RUN_LOG_CMD)

run-all: populate-directors run-update-directors run-update-films run-update-offers run-update-services run-cleanup
run-all: populate-directors run-update-directors run-update-films run-update-offers run-update-services run-cleanup dump-directors

run-db-upgrade:
pdm run alembic upgrade head
Expand Down
31,453 changes: 16,849 additions & 14,604 deletions directors.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ build-backend = "pdm.backend"
distribution = true

[project.scripts]
get-directors = "letsrolld.cmd.get_directors:main"
fetch-directors = "letsrolld.cmd.fetch_directors:main"
populate-directors = "letsrolld.cmd.populate_directors:main"
update-directors = "letsrolld.cmd.update:directors_main"
dump-directors = "letsrolld.cmd.dump_directors:main"
Expand Down
4 changes: 1 addition & 3 deletions scripts/sanity-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ StringContains() {
return 1
}

DIRECTORS_FILE=directors.csv

git worktree add ../sanity-check-env
trap "git worktree remove ../sanity-check-env" EXIT

Expand All @@ -22,7 +20,7 @@ cd ../sanity-check-env
alembic upgrade head

# populate database with some data
populate-directors -d ${DIRECTORS_FILE} -n 2
populate-directors -d tests/files/directors.csv
update-directors
update-films
update-offers
Expand Down
3 changes: 1 addition & 2 deletions src/letsrolld/cmd/dump_directors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ def main():
parser.add_argument("-f", "--force", help="output directors file", type=bool)
args = parser.parse_args()

session = sessionmaker(bind=db.create_engine())()

if not args.force and os.path.exists(args.output):
print(f"Output file {args.output} already exists, exiting...")
sys.exit(1)

with open(args.output, "w") as csvfile:
writer = csv.writer(csvfile, dialect=csv.unix_dialect)
writer.writerow(["Name", "Letterboxd URI"])
session = sessionmaker(bind=db.create_engine())()
for director in session.query(models.Director).order_by(models.Director.name):
writer.writerow([director.name, director.lb_url])

Expand Down
3 changes: 3 additions & 0 deletions tests/files/directors.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"Name","Letterboxd URI"
"Maryam Touzani","https://letterboxd.com/director/maryam-touzani/"
"Štefan Uher","https://letterboxd.com/director/stefan-uher/"
Loading