Closed iantrich closed 5 years ago
I'll try to play around with the code to see if I can better pin-point where the issue is
Number is getting passed in, the season value is not being set it looks like.
So should that line just be
self._seasons.append(TVSeason(self.title, season.number, **season))
@iantrich
your fix doesnt work. i get this error when i add your fix
self._seasons.append(TVSeason(self.title, season.number, **season)) AttributeError: 'dict' object has no attribute 'number'
@StoneMonarch yeah, that's why I didn't finish the PR. Haven't had a chance to look into it further
Fixed, see PR #100
@iantrich please mark as closed
Closing this issue since, as @StoneMonarch said, this was closed in #100.
If you run into any other issues feel free to open a new issue.
Works here. I planned to use this for an "Up Next" sensor in Home Assistant, which I do have working but unfortunately it is just too slow to get all the episodes for the most recently watched and find the next. Ends up taking ~5 minutes :( There's not an "up next" api call that I'm missing, is there?
Yeah, the trakt api isn't super quick.
Have you tried lowering the number of days when you get the calendar? By default it gets the next weeks worth of episodes, you could try setting days=2
. The response may come back faster.
I have a calendar sensor working perfectly, but the way I'm doing "Up Next" is by getting watched_shows
for the users, which has the most recently watched shows. I then iterate through those and do a TvShow.search
on each show to get all episodes, and use that to get the next show after the most recently watched. The search is where the bottleneck is.
The apparent correct way to obtain Up Next according to a note here is to "Use a combination of the /sync/watched and /shows/:id/progress methods to get what the user is actively watching." The progress endpoints are accessible with this fork (pip uninstall trakt; git clone https://github.com/glensc/python-pytrakt; cd python-pytrakt; pip install .
then import trakt as usual) and is called similar to the example in these docs with the additional function, like User(user).watched_shows[0].watched_progress()
The bug is not obvious to me, but calling the same query, manually, gives both individual seasons:
Should this line be explicit about the season number? My Python is limited and I would actually think this should be fine, as "number" looks to be returned first and would therefore be the 2nd parameter passed to init of the TvSeason as expected...I'm not sure