Calendars¶
Interfaces to all of the Calendar objects offered by the Trakt.tv API
- class trakt.calendar.Calendar(date=None, days=7, extended=None)¶
Base
Calendar
type serves as a foundation for other Calendar types- property ext¶
construct the fully formatted url for this Calendar
- url = None¶
- class trakt.calendar.MovieCalendar(date=None, days=7, extended=None)¶
TraktTV Movie Calendar. Returns all movies with a release date during the time period specified.
- url = 'calendars/all/movies'¶
- class trakt.calendar.MyMovieCalendar(date=None, days=7, extended=None)¶
Personalized TraktTV Movie Calendar.
- url = 'calendars/my/movies'¶
- class trakt.calendar.MyPremiereCalendar(date=None, days=7, extended=None)¶
Personalized calendar of all shows premiering during the time period specified.
- url = 'calendars/my/shows/new'¶
- class trakt.calendar.MySeasonCalendar(date=None, days=7, extended=None)¶
Personalized TraktTV TV Show Season Premiere
- url = 'calendars/my/shows/premieres'¶
- class trakt.calendar.MyShowCalendar(date=None, days=7, extended=None)¶
Personalized TraktTV ShowCalendar
- url = 'calendars/my/shows'¶
- class trakt.calendar.PremiereCalendar(date=None, days=7, extended=None)¶
All shows premiering during the time period specified.
- url = 'calendars/all/shows/new'¶
- class trakt.calendar.SeasonCalendar(date=None, days=7, extended=None)¶
TraktTV TV Show Season Premiere
- url = 'calendars/all/shows/premieres'¶
- class trakt.calendar.ShowCalendar(date=None, days=7, extended=None)¶
TraktTV ShowCalendar
- url = 'calendars/all/shows'¶
Example Usage¶
All four Calendar types PremiereCalendar
, ShowCalendar
, and
SeasonCalendar
and MovieCalendar
behave similarly, the only
fundamental difference is in the data they represent. They all accept optional
date and days parameters which specify the start date and length of the Calendar.
Below are some examples of these calendars in action.
>>> from trakt.calendar import PremiereCalendar
>>> p_calendar = PremiereCalendar(days=1)
>>> len(p_calendar)
21
>>> p_calendar
[<TVEpisode>: Return to Amish S1E1 Pilot,
<TVEpisode>: The Next Food Network Star S10E10 Hollywood Calling,
<TVEpisode>: Sladkaya Zhizn S1E1 Серия 1,
<TVEpisode>: Ladies of London S1E1 ,
<TVEpisode>: Longmire S3E3 The White Warrior,
<TVEpisode>: Famous in 12 S1E1 Pilot,
<TVEpisode>: Top Gear (US) S5E5 American Muscle,
<TVEpisode>: Jennifer Falls S1E1 Pilot,
<TVEpisode>: Orange Is the New Black S2E2 TBA,
...
You can also iterate over the Calendar itself
>>> for episode in p_calendar:
... print(episode)
<TVEpisode>: Return to Amish S1E1 Pilot
<TVEpisode>: The Next Food Network Star S10E10 Hollywood Calling
<TVEpisode>: Sladkaya Zhizn S1E1 Серия 1
<TVEpisode>: Ladies of London S1E1
<TVEpisode>: Longmire S3E3 The White Warrior
<TVEpisode>: Famous in 12 S1E1 Pilot
<TVEpisode>: Top Gear (US) S5E5 American Muscle
<TVEpisode>: Jennifer Falls S1E1 Pilot
<TVEpisode>: Orange Is the New Black S2E2 TBA
...