Movies¶
Interfaces to all of the Movie objects offered by the Trakt.tv API
- class trakt.movies.Movie(title, year=None, slug=None, **kwargs)¶
A Class representing a Movie object
- property aliases¶
A list of
Alias
objects representing all of the other titles that thisMovie
is known by, and the countries where they go by their alternate titles
- checkin(app_version, app_date, message='', sharing=None, venue_id='', venue_name='', delete=False)¶
Checkin this
Movie
via the TraktTV API.- :param app_version:Version number of the media center, be as specific
as you can including nightly build number, etc. Used to help debug your plugin.
- Parameters:
app_date – Build date of the media center. Used to help debug your plugin.
message – Message used for sharing. If not sent, it will use the watching string in the user settings.
sharing – Control sharing to any connected social networks.
venue_id – Foursquare venue ID.
venue_name – Foursquare venue name.
delete – If True, the checkin will be deleted.
- comment(comment_body, spoiler=False, review=False)¶
Add a comment (shout or review) to this
Move
on trakt.
- property comments¶
All comments (shouts and reviews) for this
Movie
. Most recent comments returned first.
- dismiss()¶
Dismiss this movie from showing up in Movie Recommendations
- get_releases(country_code='us')¶
Returns all :class:`Release`s for a movie including country, certification, and release date.
- Parameters:
country_code – The 2 character country code to search from
- Returns:
a
list
ofRelease
objects
- get_translations(country_code='us')¶
Returns all :class:`Translation`s for a movie, including language and translated values for title, tagline and overview.
- Parameters:
country_code – The 2 character country code to search from
- Returns:
a
list
ofTranslation
objects
- property images_ext¶
Uri to retrieve additional image information
- rate(rating, rated_at=None)¶
Rate this
Movie
on trakt. Depending on the current users settings, this may also send out social updates to facebook, twitter, tumblr, and path.
- property ratings¶
Ratings (between 0 and 10) and distribution for a movie.
- remove_from_watchlist()¶
- scrobble(progress, app_version, app_date)¶
Notify trakt that the current user has finished watching a movie. This commits this
Movie
to the current users profile. You should use movie/watching prior to calling this method.- Parameters:
progress – % progress, integer 0-100. It is recommended to call the watching API every 15 minutes, then call the scrobble API near the end of the movie to lock it in.
app_version – Version number of the media center, be as specific as you can including nightly build number, etc. Used to help debug your plugin.
app_date – Build date of the media center. Used to help debug your plugin.
- static search(title, year=None)¶
Perform a search for a movie with a title matching title
- Parameters:
title – The title to search for
year – Optional year to limit results to
- to_json()¶
- to_json_singular()¶
- property watching_now¶
A list of all
User
’s watching a movie.
- class trakt.movies.Release(country, certification, release_date, note, release_type)¶
- certification: str¶
Alias for field number 1
- country: str¶
Alias for field number 0
- note: str¶
Alias for field number 3
- release_date: str¶
Alias for field number 2
- release_type: str¶
Alias for field number 4
- class trakt.movies.Translation(title, overview, tagline, language)¶
- language: str¶
Alias for field number 3
- overview: str¶
Alias for field number 1
- tagline: str¶
Alias for field number 2
- title: str¶
Alias for field number 0
- trakt.movies.dismiss_recommendation(title)¶
Dismiss the movie matching the specified criteria from showing up in recommendations.
- trakt.movies.get_recommended_movies()¶
Get a list of
Movie
’s recommended based on your watching history and your friends. Results are returned with the top recommendation first.
- trakt.movies.updated_movies(timestamp=None)¶
Returns all movies updated since a timestamp. The server time is in PST. To establish a baseline timestamp, you can use the server/time method. It’s recommended to store the timestamp so you can be efficient in using this method.
Example Usage¶
The trakt.movies module has a handful of functionality for interfacing with
the Movies hosted on Trakt.tv. The module has a few functions which you will
need to be authenticated for. The dismiss_recommendation()
function will
block the specified movie from being shown in your recommended movies.
>>> from trakt.movies import dismiss_recommendation
>>> dismiss_recommendation('Son of Batman')
This code snippet would prevent Son of Batman from appearing in your recommended
movies list. Following the previous example you can use the
get_recommended_movies()
function to get the list of movies recommended for
the currently authenticated user.
>>> from trakt.movies import get_recommended_movies
>>> all_movies = get_recommended_movies()
>>> all_movies
[<Movie>: 'The Dark Knight', <Movie>: 'WALLE', <Movie>: 'Up', <Movie>: 'Toy Story',...
There are a few properties that belong to the trakt.movies module as well.
>>> from trakt import movies
>>> movies.genres()
[Genre(name='Action', slug='action'), Genre(name='Adventure', slug='adventure'),...
>>> movies.trending_movies()
[<Movie>: 'The LEGO Movie', <Movie>: 'Non-Stop', <Movie>: 'Frozen', <Movie>: 'RoboCop',...
>>> movies.updated_movies()
[]
Now to the Movie object. It’s pretty straightforward, you provide a title and an optional year, and you will be returned an interface to that Movie on trakt.tv.
>>> from trakt.movies import Movie
>>> batman = Movie('Son of Batman', 2014)
>>> batman.overview
'Batman learns that he has a violent, unruly pre-teen son with Talia al Ghul named Damian Wayne who is secretly being...
>>> batman.released
'2014-04-22'
>>> batman.genres
[Genre(name='Action', slug='action'), Genre(name='Adventure', slug='adventure'), Genre(name='Animation', slug='animation')]
>>> batman.add_to_library()
>>> batman.mark_as_seen()