Skip to content

Commit

Permalink
letterboxd: replace : with _
Browse files Browse the repository at this point in the history
  • Loading branch information
ngalaiko committed Jan 26, 2025
1 parent 01c6410 commit 05bf877
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "\u041a\u0443\u0445\u043d\u044f",
"title_slug": "film:111902",
"title_slug": "film_111902",
"date": "2025-01-23",
"is_rewatch": true,
"is_liked": true,
Expand Down
5 changes: 3 additions & 2 deletions scripts/update/letterboxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ def parse_watch_number(href):
return 0

watch_number = parse_watch_number(entry["href"])
title_slug = entry["title_slug"].replace(":", "_")
watch_number = (
watch_number if watch_number < 10 else 0
) # because movie 1917 exists
data_output = os.path.join(output, entry["title_slug"], f"{watch_number}.json")
data_output = os.path.join(output, title_slug, f"{watch_number}.json")

os.makedirs(os.path.dirname(data_output), exist_ok=True)

if not os.path.exists(data_output):
with open(data_output, "w") as f:
json.dump(entry, f, indent=4, default=str)

poster_output = os.path.join(output, f"{entry['title_slug']}.jpg")
poster_output = os.path.join(output, f"{title_slug}.jpg")

if not os.path.exists(poster_output):
image = get_poster(entry)
Expand Down

0 comments on commit 05bf877

Please sign in to comment.