Swap media_type/type names
MODIFY
plex_trakt_sync/plex_api.py
plex_trakt_sync/plex_api.py
@@ -29,12 +29,12 @@ def guids(self):
@property
@memoize
- def type(self):
- return f"{self.media_type}s"
+ def media_type(self):
+ return f"{self.type}s"
@property
@memoize
- def media_type(self):
+ def type(self):
return self.item.type
@property
@@ -48,7 +48,7 @@ def provider(self):
x = x.replace("themoviedb", "tmdb")
x = x.replace("thetvdb", "tvdb")
if x == "xbmcnfo":
- x = CONFIG["xbmc-providers"][self.type]
+ x = CONFIG["xbmc-providers"][self.media_type]
return x

MODIFY
plex_trakt_sync/trakt_api.py
plex_trakt_sync/trakt_api.py
@@ -203,7 +203,7 @@ def lookup(self, tm: TVShow):
@rate_limit()
def find_movie(self, media: PlexLibraryItem):
try:
- search = trakt.sync.search_by_id(media.id, id_type=media.provider, media_type=media.media_type)
+ search = trakt.sync.search_by_id(media.id, id_type=media.provider, media_type=media.type)
except JSONDecodeError as e:
raise ValueError(f"Unable parse search result for {media.provider}/{media.id}: {e.doc!r}") from e
except ValueError as e:
@@ -211,7 +211,7 @@ def find_movie(self, media: PlexLibraryItem):
raise ValueError(f"Invalid id_type: '{media.provider}', guid: '{media.guid}', guids: '{media.item.guids}': {e}") from e
# look for the first wanted type in the results
for m in search:
- if m.media_type == media.type:
+ if m.media_type == media.media_type:
return m
return None

MODIFY
tests/test_new_agent.py
tests/test_new_agent.py
@@ -26,7 +26,7 @@ def test_tv_lookup():
assert m.provider == 'imdb'
assert m.id == 'tt2661044'
- assert m.media_type == 'show'
+ assert m.type == 'show'
def test_tv_lookup_none():
@@ -40,4 +40,4 @@ def test_tv_lookup_none():
assert m.provider == 'none'
assert m.id == '68178'
- assert m.media_type == 'show'
+ assert m.type == 'show'

Swap media_type/type names