From 0816e3bbf81b7f42bbce790bc8ee9f5220c6d9e6 Mon Sep 17 00:00:00 2001 From: fl0v <7046246+fl0v@users.noreply.github.com> Date: Sun, 1 Dec 2024 19:08:52 +0100 Subject: [PATCH] Fix movie lookup by title and year Jellyfin json response defines ProductionYear as number so we need to cast it as string to compare with item release_year --- utils/jellyfin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/jellyfin.py b/utils/jellyfin.py index 0ed80eb..df00434 100644 --- a/utils/jellyfin.py +++ b/utils/jellyfin.py @@ -117,7 +117,7 @@ def add_item_to_collection(self, collection_id: str, item, year_filter: bool = T # Check if there's a year match if match is None and year_filter: for result in res.json()["Items"]: - if result.get("ProductionYear", None) == item["release_year"]: + if str(result.get("ProductionYear", None)) == str(item["release_year"]): match = result break @@ -126,7 +126,7 @@ def add_item_to_collection(self, collection_id: str, item, year_filter: bool = T match = res.json()["Items"][0] if match is None: - logger.warning(f"Item {item['title']} not found in jellyfin") + logger.warning(f"Item {item['title']} ({item.get('release_year','N/A')}) {item.get('imdb_id','N/A')} not found in jellyfin") else: try: item_id = res.json()["Items"][0]["Id"]