Skip to content

Commit

Permalink
Merge pull request #138 from remos/plex-guid-fix
Browse files Browse the repository at this point in the history
Plex: fix guid lookup for X -> Plex sync
  • Loading branch information
luigi311 committed Jan 12, 2024
2 parents 95f2a9a + c6affc3 commit 28c1661
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,18 @@ def find_video(plex_search, video_ids, videos=None):
if videos:
for show, seasons in videos.items():
show = {k: v for k, v in show}
if guid_source in show["ids"].keys():
if guid_id in show["ids"][guid_source]:
for season in seasons:
if guid_source in show.keys():
if guid_id == show[guid_source]:
for season in seasons.values():
for episode in season:
episode_videos.append(episode)

return True, episode_videos

return False, []
except Exception:
logger(f"Plex: failed to find library item for {video_ids['title']}", 2)
logger(traceback.format_exc(), 2)
return False, []


Expand All @@ -234,12 +236,14 @@ def get_video_status(plex_search, video_ids, videos):
if guid_source in video_ids.keys():
if guid_id in video_ids[guid_source]:
for video in videos:
if guid_source in video["ids"].keys():
if guid_id in video["ids"][guid_source]:
if guid_source in video.keys():
if guid_id == video[guid_source]:
return video["status"]

return None
except Exception:
logger(f"Plex: failed to find library item for {video_ids['title']}", 2)
logger(traceback.format_exc(), 2)
return None


Expand Down

0 comments on commit 28c1661

Please sign in to comment.