Skip to content

Commit

Permalink
jf return status
Browse files Browse the repository at this point in the history
  • Loading branch information
ghomasHudson committed Dec 31, 2024
1 parent fbae6f7 commit 1d4cce0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils/jellyfin.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,18 @@ def add_item_to_collection(self, collection_id: str, item, year_filter: bool = T

if match is None:
logger.warning(f"Item {item['title']} ({item.get('release_year','N/A')}) {item.get('imdb_id','')} not found in jellyfin")
return False
else:
try:
item_id = res.json()["Items"][0]["Id"]
requests.post(f'{self.server_url}/Collections/{collection_id}/Items?ids={item_id}',headers={"X-Emby-Token": self.api_key})
logger.info(f"Added {item['title']} to collection")
return True
except json.decoder.JSONDecodeError:
logger.error(f"Error adding {item['title']} to collection - JSONDecodeError")
return
return False



def clear_collection(self, collection_id: str):
'''Clears a collection by removing all items from it'''
Expand Down

0 comments on commit 1d4cce0

Please sign in to comment.