mirror of
https://github.com/FuzzyGrim/Yamtrack.git
synced 2026-06-27 22:35:55 +00:00
add letterboxd redirect path as an external link (#1163)
* add letterboxd redirect path as an external link
This commit is contained in:
@@ -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", {}),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user