Open cristianoisaac opened 3 years ago
I fixed the problem for me. I just modified the def seasons(self) to this: class TVShow(object): ......... def seasons(self): ......... self._seasons.append(TVSeason(self.title,season['number'], self.slug, **season))
See if this fits right in the code of if it needs another adjustment. In my tests it worked.
Fixes should be posted as pull requests, not as comments
I had the same issue:
>>> from trakt.tv import TVShow
>>> show = TVShow.search("lost", 2004)[0]
>>> show.seasons
[<TVSeason>: Lost Season 0, <TVSeason>: Lost Season 1, <TVSeason>: Lost Season 2, <TVSeason>: Lost Season 3, <TVSeason>: Lost Season 4, <TVSeason>: Lost Season 5, <TVSeason>: Lost Season 6]
>>> show.to_json()
{'shows': [{'title': 'Lost', 'year': 2004, 'ids': {'ids': {'trakt': 4583, 'slug': 'lost-2004', 'imdb': 'tt0411008', 'tmdb': 4607, 'tvdb': 73739}}}]}
>>> show.seasons[0].to_json()
{'shows': [{'shows': [{'title': 'Lost', 'year': 2001, 'ids': {'ids': {'trakt': 1564, 'slug': 'lost', 'imdb': 'tt0292816', 'tmdb': 1575, 'tvdb': 72906}}}], 'seasons': [{'number': 0}]}]}
It works when using the fix provided by @Fizard:
>>> from trakt.tv import TVShow
>>> show = TVShow.search("lost", 2004)[0]
>>> show.seasons
[<TVSeason>: Lost Season 0, <TVSeason>: Lost Season 1, <TVSeason>: Lost Season 2, <TVSeason>: Lost Season 3, <TVSeason>: Lost Season 4, <TVSeason>: Lost Season 5, <TVSeason>: Lost Season 6]
>>> show.to_json()
{'shows': [{'title': 'Lost', 'year': 2004, 'ids': {'ids': {'trakt': 4583, 'slug': 'lost-2004', 'imdb': 'tt0411008', 'tmdb': 4607, 'tvdb': 73739}}}]}
>>> show.seasons[0].to_json()
{'shows': [{'shows': [{'title': 'Lost', 'year': 2004, 'ids': {'ids': {'trakt': 4583, 'slug': 'lost-2004', 'imdb': 'tt0411008', 'tmdb': 4607, 'tvdb': 73739}}}], 'seasons': [{'number': 0}]}]}
PR created: #197
Thanks for the answer in issue 154, but when I upgraded to version 3.2.1 and tried to do this code: show=trakt.tv.search('Hunter x Hunter',year=2011) season = show.seasons[2] logging.info("season: %s. Season.ext: %s",season,season.ext) The answer was still this: season:: Hunter x Hunter Season 2. Season.ext: shows/hunter-x-hunter/seasons/2
(It should be shows/hunter-x-hunter-2011/seasons/2)
But when I do just this before using show.seasons function it shows right. Seems like a problem in "seasons" function (not the search): logging.info("show.title: %s. show.year: %s. titleObj.yearValue: %s. show.ids: %s. URL: https://trakt.tv/%s",show.title,show.year,titleObj.yearValue,show.ids,show.ext) Answer: show.title: Hunter x Hunter. show.year: 2011. titleObj.yearValue: 2011. show.ids: {'ids': {'trakt': 64409, 'slug': 'hunter-x-hunter-2011', 'imdb': 'tt2098220', 'tmdb': 46298, 'tvdb': 252322}}. URL: https://trakt.tv/shows/hunter-x-hunter-2011 Am I missing something?
Originally posted by @Fizard in https://github.com/moogar0880/PyTrakt/issues/154#issuecomment-895318853