Skip to content

Commit

Permalink
Extract find_by_episode_guid method
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Jan 8, 2024
1 parent eee4151 commit 80696af
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions plextraktsync/trakt/TraktApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,18 @@ def remove_from_watchlist(self, m):

self.queue.remove_from_watchlist((m.media_type, item))

def find_by_episode_guid(self, guid: PlexGuid):
ts: TVShow = self.search_by_id(guid.show_id, id_type=guid.provider, media_type="show")
if not ts:
return None

lookup = TraktLookup(ts)

return self.find_episode_guid(guid, lookup)

def find_by_guid(self, guid: PlexGuid):
if guid.type == "episode" and guid.is_episode:
ts: TVShow = self.search_by_id(
guid.show_id, id_type=guid.provider, media_type="show"
)
if ts:
lookup = TraktLookup(ts)

return self.find_episode_guid(guid, lookup)
return self.find_by_episode_guid(guid)
else:
tm = self.search_by_id(guid.id, id_type=guid.provider, media_type=guid.type)
if tm is None and guid.type == "movie":
Expand Down

0 comments on commit 80696af

Please sign in to comment.