Add error logging for search returning wrong media type
@@ -214,8 +214,13 @@ def find_by_media(self, pm: PlexLibraryItem):
def search_by_id(self, media_id: str, id_type: str, media_type: str):
search = trakt.sync.search_by_id(media_id, id_type=id_type, media_type=media_type)
# look for the first wanted type in the results
+ # NOTE: this is not needed, kept around for caution
for m in search:
- if m.media_type == f"{media_type}s":
+ if m.media_type != f"{media_type}s":
+ logger.error(
+ f"Internal error, wrong media type: {m.media_type}. Please report this to PlexTraktSync developers"
+ )
+ continue
return m
return None
