moogar0880 / PyTrakt

A Pythonic interface to the Trakt.tv REST API
Other
64 stars 50 forks source link

[4.0.0]: Refactor: Index seasons and shows by their number #185

Open glensc opened 2 years ago

glensc commented 2 years ago

Extracted from https://github.com/moogar0880/PyTrakt/pull/176 as the changes are breaking changes.

This will make only one trakt.tv API request to create list of TVSeason with TVEpisode objects.

The properties are indexed in a dict by .number rather being a list:

    show = TVShow('Game of Thrones')

    seasons = show.seasons
    assert len(seasons) == 9
    assert seasons[1].episodes[1].title == 'Winter Is Coming'