add letterboxd redirect path as an external link (#1163)

* add letterboxd redirect path as an external link
This commit is contained in:
Connor Burton
2026-02-22 22:58:29 +00:00
committed by GitHub
parent dcd467cea6
commit 7faab9fd92

View File

@@ -41,7 +41,7 @@ def handle_error(error):
)
def get_external_links(external_ids):
def get_external_links(external_ids, tmdb_id=None):
"""Build external links dictionary from TMDB external_ids response."""
links = {}
@@ -58,6 +58,13 @@ def get_external_links(external_ids):
f"https://www.wikidata.org/wiki/{external_ids['wikidata_id']}"
)
# Only passed in for movies as Letterboxd seldom supports TV
if tmdb_id:
# https://letterboxd.com/about/film-data/
# Letterboxd will redirect to the correct movie
# as they source their data from TMDB
links["Letterboxd"] = f"https://www.letterboxd.com/tmdb/{tmdb_id}"
return links
@@ -229,7 +236,10 @@ def movie(media_id):
MediaTypes.MOVIE.value,
),
},
"external_links": get_external_links(response.get("external_ids", {})),
"external_links": get_external_links(
response.get("external_ids", {}),
media_id
),
"providers": response.get("watch/providers", {}).get("results", {}),
}