Movies¶
Interfaces to all of the Movie objects offered by the Trakt.tv API
-
trakt.movies.dismiss_recommendation(*args, **kwargs)¶ Dismiss the movie matching the specified criteria from showing up in recommendations.
-
trakt.movies.get_recommended_movies(*args, **kwargs)¶ 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(*args, **kwargs)¶ 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.
-
class
trakt.movies.Release(country, certification, release_date, note, release_type)¶ -
certification¶ Alias for field number 1
-
country¶ Alias for field number 0
-
note¶ Alias for field number 3
-
release_date¶ Alias for field number 2
-
release_type¶ Alias for field number 4
-
-
class
trakt.movies.Movie(title, year=None, slug=None, **kwargs)¶ A Class representing a Movie object
-
aliases¶ A list of
Aliasobjects representing all of the other titles that thisMovieis known by, and the countries where they go by their alternate titles
-
comment(comment_body, spoiler=False, review=False)¶ Add a comment (shout or review) to this
Moveon trakt.
-
dismiss()¶ Dismiss this movie from showing up in Movie Recommendations
-
get_releases(**kwargs)¶ 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 listofReleaseobjects
-
get_translations(**kwargs)¶ 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 listofTranslationobjects
-
ids¶ Accessor to the trakt, imdb, and tmdb ids, as well as the trakt.tv slug
-
images_ext¶ Uri to retrieve additional image information
-
rate(rating)¶ Rate this
Movieon trakt. Depending on the current users settings, this may also send out social updates to facebook, twitter, tumblr, and path.
-
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
Movieto 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.
-
classmethod
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()¶
-
watching_now¶ A list of all
User’s watching a movie.
-
-
class
trakt.movies.Translation(title, overview, tagline, language)¶ -
language¶ Alias for field number 3
-
overview¶ Alias for field number 1
-
tagline¶ Alias for field number 2
-
title¶ Alias for field number 0
-
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(imdb_id='tt3139072', title='Son of Batman',
... year=2014)
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>: b'The Dark Knight', <Movie>: b'WALLE', <Movie>: b'Up', <Movie>: b'Toy Story',...
There’s also a function to quickly rate a list of movies as the currently authenticated user.
>>> from trakt.movies import Movie, rate_movies
>>> rate_movies(all_movies, 'love')
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>: b'The LEGO Movie', <Movie>: b'Non-Stop', <Movie>: b'Frozen', <Movie>: b'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')
>>> 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_iso
'2014-04-20T07:00:00'
>>> 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()