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.

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.genres(*args, **kwargs)

A list of all possible Movie Genres

trakt.movies.trending_movies(*args, **kwargs)

All Movie’s being watched right now

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

add_to_collection()

Add this Movie to your library.

add_to_library()

Add this Movie to your library.

add_to_watchlist()

Add this Movie to your watchlist

aliases

A list of Alias objects representing all of the other titles that this Movie is known by, and the countries where they go by their alternate titles

cast

All of the cast members that worked on this Movie

comment(comment_body, spoiler=False, review=False)

Add a comment (shout or review) to this Move on trakt.

comments

All comments (shouts and reviews) for this Movie. Most recent comments returned first.

crew

All of the crew members that worked on this Movie

dismiss()

Dismiss this movie from showing up in Movie Recommendations

ext

Base uri to retrieve basic information about this Movie

ext_full

Uri to retrieve all information about this Movie

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 list of Release objects
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 list of Translation objects
ids

Accessor to the trakt, imdb, and tmdb ids, as well as the trakt.tv slug

images

All of the artwork associated with this Movie

images_ext

Uri to retrieve additional image information

mark_as_seen(watched_at=None)

Add this Movie, watched outside of trakt, to your library.

mark_as_unseen()

Remove this Movie, watched outside of trakt, from your library.

people

A list of all of the People involved in this Movie, including both cast and crew

rate(rating)

Rate this Movie on 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.

related

The top 10 Movie’s related to this Movie

remove_from_collection()

Remove this Movie from your library.

remove_from_library()

Remove this Movie from your library.

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.
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()