flexget.components.trakt.db module#
- class flexget.components.trakt.db.TraktActor(actor, session)[source]#
Bases:
VersionedBase- _sa_class_manager = {'biography': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'birthday': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'death': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'homepage': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'imdb': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'slug': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tmdb': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- biography#
- birthday#
- death#
- homepage#
- id#
- imdb#
- name#
- slug#
- tmdb#
- class flexget.components.trakt.db.TraktEpisode(trakt_episode, session)[source]#
Bases:
VersionedBase- update(trakt_episode, session)[source]#
Update this record from the trakt media object trakt_episode returned by the trakt api.
- _sa_class_manager = {'cached_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'first_aired': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'imdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'number': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'number_abs': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'overview': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'season': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'series_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'title': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tmdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tvdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tvrage_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'updated_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- cached_at#
- property expired#
- first_aired#
- id#
- imdb_id#
- number#
- number_abs#
- overview#
- season#
- series_id#
- title#
- tmdb_id#
- tvdb_id#
- tvrage_id#
- updated_at#
- class flexget.components.trakt.db.TraktGenre(**kwargs)[source]#
Bases:
VersionedBase- _sa_class_manager = {'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- name#
- class flexget.components.trakt.db.TraktMovie(trakt_movie, session)[source]#
Bases:
VersionedBase- update(trakt_movie, session)[source]#
Update this record from the trakt media object trakt_movie returned by the trakt api.
- _actors#
- _sa_class_manager = {'_actors': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, '_translation_languages': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, '_translations': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'cached_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'genres': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'homepage': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'imdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'language': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'overview': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'rating': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'released': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'runtime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'slug': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tagline': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'title': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tmdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'trailer': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'translation_languages': <sqlalchemy.orm.attributes.create_proxied_attribute.<locals>.Proxy object>, 'updated_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'votes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'year': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- _translation_languages#
- _translations#
- property actors#
- cached_at#
- property expired#
- Returns:
True if movie details are considered to be expired, ie. need of update
- genres#
- homepage#
- id#
- imdb_id#
- language#
- overview#
- rating#
- released#
- runtime#
- slug#
- tagline#
- title#
- tmdb_id#
- trailer#
- translation_languages#
- property translations#
- updated_at#
- votes#
- year#
- class flexget.components.trakt.db.TraktMovieIds(trakt_id=None, trakt_slug=None, tmdb_id=None, imdb_id=None, **kwargs)[source]#
Bases:
objectSimple class that holds a variety of possible IDs that Trakt utilize in their API, eg. imdb id, trakt id.
- class flexget.components.trakt.db.TraktMovieSearchResult(search, movie_id=None, movie=None)[source]#
Bases:
VersionedBase- _sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'movie': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'movie_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'search': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- id#
- movie#
- movie_id#
- search#
- class flexget.components.trakt.db.TraktMovieTranslation(translation, session)[source]#
Bases:
VersionedBase- _sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'language': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'movie_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'overview': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tagline': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'title': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- id#
- language#
- movie_id#
- overview#
- tagline#
- title#
- class flexget.components.trakt.db.TraktSeason(trakt_season, session)[source]#
Bases:
VersionedBase- update(trakt_season, session)[source]#
Update this record from the trakt media object trakt_episode returned by the trakt api.
- _sa_class_manager = {'aired_episodes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'cached_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'episode_count': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'first_aired': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'number': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'overview': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'ratings': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'series_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'title': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tmdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tvdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tvrage_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'votes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- aired_episodes#
- cached_at#
- episode_count#
- property expired#
- first_aired#
- id#
- number#
- overview#
- ratings#
- series_id#
- title#
- tmdb_id#
- tvdb_id#
- tvrage_id#
- votes#
- class flexget.components.trakt.db.TraktShow(trakt_show, session)[source]#
Bases:
VersionedBase- update(trakt_show, session)[source]#
Update this record from the trakt media object trakt_show returned by the trakt api.
- _actors#
- _sa_class_manager = {'_actors': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, '_translation_languages': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, '_translations': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'air_day': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'air_time': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'aired_episodes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'cached_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'certification': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'country': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'episodes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'first_aired': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'genres': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'homepage': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'imdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'language': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'network': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'overview': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'rating': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'runtime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'seasons': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'slug': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'status': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'timezone': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'title': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tmdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'trailer': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'translation_languages': <sqlalchemy.orm.attributes.create_proxied_attribute.<locals>.Proxy object>, 'tvdb_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tvrage_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'updated_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'votes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'year': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- _translation_languages#
- _translations#
- property actors#
- air_day#
- air_time#
- aired_episodes#
- cached_at#
- certification#
- country#
- episodes#
- property expired#
- Returns:
True if show details are considered to be expired, ie. need of update
- first_aired#
- genres#
- homepage#
- id#
- imdb_id#
- language#
- network#
- overview#
- rating#
- runtime#
- seasons#
- slug#
- status#
- timezone#
- title#
- tmdb_id#
- trailer#
- translation_languages#
- property translations#
- tvdb_id#
- tvrage_id#
- updated_at#
- votes#
- year#
- class flexget.components.trakt.db.TraktShowIds(trakt_id=None, trakt_slug=None, tmdb_id=None, imdb_id=None, tvdb_id=None, tvrage_id=None, **kwargs)[source]#
Bases:
objectSimple class that holds a variety of possible IDs that Trakt utilize in their API, eg. imdb id, trakt id.
- class flexget.components.trakt.db.TraktShowSearchResult(search, series_id=None, series=None)[source]#
Bases:
VersionedBase- _sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'search': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'series': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'series_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- id#
- search#
- series#
- series_id#
- class flexget.components.trakt.db.TraktShowTranslation(translation, session)[source]#
Bases:
VersionedBase- _sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'language': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'overview': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'show_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'title': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- id#
- language#
- overview#
- show_id#
- title#
- class flexget.components.trakt.db.TraktUserAuth(account, access_token, refresh_token, created, expires)[source]#
Bases:
VersionedBase- _sa_class_manager = {'access_token': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'account': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'created': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'expires': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'refresh_token': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- access_token#
- account#
- created#
- expires#
- refresh_token#
- flexget.components.trakt.db.get_access_token(account, token=None, refresh=False, re_auth=False, called_from_cli=False)[source]#
Get authorization info from a pin or refresh token.
- Parameters:
account – Arbitrary account name to attach authorization to.
token (unicode) – The pin or refresh token, as supplied by the trakt website.
refresh (bool) – If True, refresh the access token using refresh_token from db.
re_auth (bool) – If True, account is re-authorized even if it already exists in db.
- Raises:
RequestException – If there is a network error while authorizing.
- flexget.components.trakt.db.get_api_url(*endpoint)[source]#
Get the address of a trakt API endpoint.
- Parameters:
endpoint – Can by a string endpoint (e.g. ‘sync/watchlist’) or an iterable (e.g. (‘sync’, ‘watchlist’) Multiple parameters can also be specified instead of a single iterable.
- Returns:
The absolute url to the specified API endpoint.
- flexget.components.trakt.db.get_entry_ids(entry)[source]#
Create a trakt ids dict from id fields on an entry. Prefer already populated info over lazy lookups.
- Parameters:
entry (Entry)
- flexget.components.trakt.db.get_item_from_cache(table, session, title=None, year=None, trakt_ids=None)[source]#
Get the cached info for a given show/movie from the database.
- Parameters:
table – Either TraktMovie or TraktShow
title – Title of the show/movie
year – First release year
trakt_ids – instance of TraktShowIds or TraktMovieIds
session – database session object
- Returns:
query result
- flexget.components.trakt.db.get_session(account=None, token=None)[source]#
Create a requests session ready to talk to trakt API with FlexGet’s api key.
Can also add user level authentication if account parameter is given.
- Parameters:
account – An account authorized via flexget trakt auth CLI command. If given, returned session will be authenticated for that account.
- flexget.components.trakt.db.get_trakt_data(media_type, title=None, year=None, trakt_ids=None)[source]#
- flexget.components.trakt.db.get_user_data(data_type, media_type, session, username)[source]#
Fetch user data from Trakt.tv on the /users/<username>/<data_type>/<media_type> end point.
Example: a user’s movie collection is fetched from /users/<username>/collection/movies.
- Parameters:
data_type – Name of the data type eg. collection, watched etc.
media_type – Type of media we want <data_type> for eg. shows, episodes, movies.
session – A trakt requests session with a valid token
username – Username of the user to fetch data
- Returns:
- flexget.components.trakt.db.get_username(username=None, account=None)[source]#
Return ‘me’ if account is provided and username is not.