Skip to content

Commit 1d4cce0

Browse files
committed
jf return status
1 parent fbae6f7 commit 1d4cce0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

utils/jellyfin.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,18 @@ def add_item_to_collection(self, collection_id: str, item, year_filter: bool = T
127127

128128
if match is None:
129129
logger.warning(f"Item {item['title']} ({item.get('release_year','N/A')}) {item.get('imdb_id','')} not found in jellyfin")
130+
return False
130131
else:
131132
try:
132133
item_id = res.json()["Items"][0]["Id"]
133134
requests.post(f'{self.server_url}/Collections/{collection_id}/Items?ids={item_id}',headers={"X-Emby-Token": self.api_key})
134135
logger.info(f"Added {item['title']} to collection")
136+
return True
135137
except json.decoder.JSONDecodeError:
136138
logger.error(f"Error adding {item['title']} to collection - JSONDecodeError")
137-
return
139+
return False
140+
141+
138142

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

0 commit comments

Comments
 (0)