From b5ab2f8a345b838938aaec9b43c12ae906733129 Mon Sep 17 00:00:00 2001 From: yitzhaq <17812841+yitzhaq@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:42:09 +0200 Subject: [PATCH 1/2] Include tvdb in .ids accessor IdsMixin.ids built its dict from a curated key list that omitted tvdb, even though a tvdb property already exists on the mixin and Trakt returns tvdb for shows. So obj.ids["ids"] never contained tvdb, breaking tvdb-based id matching downstream: PlexTraktSync's search_by_id checks m.ids["ids"].get("tvdb"), which was always None, so every show in a library using the legacy TheTVDB Plex agent is rejected as "not found on Trakt" even though m.tvdb is populated. Add tvdb to the accessor list. tvdb is a TV-only id, so filter out None values: shows/episodes gain tvdb while movies, people and other media that lack it keep their existing .ids output unchanged (no null tvdb key). Co-Authored-By: Claude Opus 4.8 (1M context) --- trakt/mixins.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/trakt/mixins.py b/trakt/mixins.py index 3859dee..8c30241 100644 --- a/trakt/mixins.py +++ b/trakt/mixins.py @@ -35,7 +35,7 @@ class IdsMixin: This is replacement for extract_ids() utility method. """ - __ids = ['imdb', 'slug', 'tmdb', 'trakt'] + __ids = ['imdb', 'slug', 'tmdb', 'trakt', 'tvdb'] def __init__(self, ids=None): if ids is None: @@ -45,10 +45,11 @@ def __init__(self, ids=None): @property def ids(self): """ - Accessor to the trakt, imdb, and tmdb ids, - as well as the trakt.tv slug + Accessor to the trakt, imdb, tmdb and tvdb ids, as well as the + trakt.tv slug. Only ids present on the object are included. """ ids = {k: getattr(self, k, None) for k in self.__ids} + ids = {k: v for k, v in ids.items() if v is not None} return { 'ids': ids } From 49d93db8569ee3091b5d2c042eab051949e418af Mon Sep 17 00:00:00 2001 From: yitzhaq <17812841+yitzhaq@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:42:09 +0200 Subject: [PATCH 2/2] Test tvdb is included in a show's .ids Regression for tvdb being omitted from the ids accessor list: assert a show exposes its tvdb both via .tvdb and in .ids["ids"]. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test_shows.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_shows.py b/tests/test_shows.py index 58da4fb..b4ba3a6 100644 --- a/tests/test_shows.py +++ b/tests/test_shows.py @@ -159,3 +159,12 @@ def test_next_episode(): def test_last_episode(): got = TVShow('Game of Thrones') assert isinstance(got.last_episode, TVEpisode) + + +def test_show_ids_include_tvdb(): + # tvdb is a primary Trakt id with an existing accessor; it must be present + # in .ids so downstream tvdb-guid matching (e.g. PlexTraktSync) resolves. + # Regression for tvdb being omitted from the ids accessor list. + got = TVShow('Game of Thrones') + assert got.tvdb == 121361 + assert got.ids['ids']['tvdb'] == 121361