Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TVSeason - Season problems with Shows with the same name and different Year #156

Open
cristianoisaac opened this issue Aug 10, 2021 · 3 comments · May be fixed by #197
Open

TVSeason - Season problems with Shows with the same name and different Year #156

cristianoisaac opened this issue Aug 10, 2021 · 3 comments · May be fixed by #197

Comments

@cristianoisaac
Copy link

cristianoisaac commented Aug 10, 2021

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 #154 (comment)

@cristianoisaac
Copy link
Author

cristianoisaac commented Aug 10, 2021

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.

@glensc
Copy link
Contributor

glensc commented Jan 15, 2022

Fixes should be posted as pull requests, not as comments

@BapRx
Copy link

BapRx commented Feb 19, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants