|
|
@ -3,6 +3,7 @@ import time
|
|
|
|
|
|
|
|
|
|
|
|
import backoff
|
|
|
|
import backoff
|
|
|
|
import requests
|
|
|
|
import requests
|
|
|
|
|
|
|
|
from cashier import cache
|
|
|
|
|
|
|
|
|
|
|
|
from helpers.misc import backoff_handler, dict_merge
|
|
|
|
from helpers.misc import backoff_handler, dict_merge
|
|
|
|
from helpers.trakt import extract_list_user_and_key_from_url
|
|
|
|
from helpers.trakt import extract_list_user_and_key_from_url
|
|
|
@ -377,6 +378,7 @@ class Trakt:
|
|
|
|
object_name='show',
|
|
|
|
object_name='show',
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_trending_shows(self, limit=1000, languages=None, genres=None):
|
|
|
|
def get_trending_shows(self, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/shows/trending',
|
|
|
|
url='https://api.trakt.tv/shows/trending',
|
|
|
@ -387,6 +389,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_popular_shows(self, limit=1000, languages=None, genres=None):
|
|
|
|
def get_popular_shows(self, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/shows/popular',
|
|
|
|
url='https://api.trakt.tv/shows/popular',
|
|
|
@ -397,6 +400,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_anticipated_shows(self, limit=1000, languages=None, genres=None):
|
|
|
|
def get_anticipated_shows(self, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/shows/anticipated',
|
|
|
|
url='https://api.trakt.tv/shows/anticipated',
|
|
|
@ -407,6 +411,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_person_shows(self, person, limit=1000, languages=None, genres=None):
|
|
|
|
def get_person_shows(self, person, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/people/%s/shows' % person,
|
|
|
|
url='https://api.trakt.tv/people/%s/shows' % person,
|
|
|
@ -417,6 +422,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_most_played_shows(self, limit=1000, languages=None, genres=None, most_type=None):
|
|
|
|
def get_most_played_shows(self, limit=1000, languages=None, genres=None, most_type=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/shows/played/%s' % ('weekly' if not most_type else most_type),
|
|
|
|
url='https://api.trakt.tv/shows/played/%s' % ('weekly' if not most_type else most_type),
|
|
|
@ -427,6 +433,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_most_watched_shows(self, limit=1000, languages=None, genres=None, most_type=None):
|
|
|
|
def get_most_watched_shows(self, limit=1000, languages=None, genres=None, most_type=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/shows/watched/%s' % ('weekly' if not most_type else most_type),
|
|
|
|
url='https://api.trakt.tv/shows/watched/%s' % ('weekly' if not most_type else most_type),
|
|
|
@ -437,6 +444,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_recommended_shows(self, authenticate_user=None, limit=1000, languages=None, genres=None):
|
|
|
|
def get_recommended_shows(self, authenticate_user=None, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/recommendations/shows',
|
|
|
|
url='https://api.trakt.tv/recommendations/shows',
|
|
|
@ -482,6 +490,7 @@ class Trakt:
|
|
|
|
object_name='movie',
|
|
|
|
object_name='movie',
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_trending_movies(self, limit=1000, languages=None, genres=None):
|
|
|
|
def get_trending_movies(self, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/movies/trending',
|
|
|
|
url='https://api.trakt.tv/movies/trending',
|
|
|
@ -492,6 +501,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_popular_movies(self, limit=1000, languages=None, genres=None):
|
|
|
|
def get_popular_movies(self, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/movies/popular',
|
|
|
|
url='https://api.trakt.tv/movies/popular',
|
|
|
@ -502,6 +512,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_anticipated_movies(self, limit=1000, languages=None, genres=None):
|
|
|
|
def get_anticipated_movies(self, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/movies/anticipated',
|
|
|
|
url='https://api.trakt.tv/movies/anticipated',
|
|
|
@ -512,6 +523,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_person_movies(self, person, limit=1000, languages=None, genres=None):
|
|
|
|
def get_person_movies(self, person, limit=1000, languages=None, genres=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/people/%s/movies' % person,
|
|
|
|
url='https://api.trakt.tv/people/%s/movies' % person,
|
|
|
@ -522,6 +534,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_most_played_movies(self, limit=1000, languages=None, genres=None, most_type=None):
|
|
|
|
def get_most_played_movies(self, limit=1000, languages=None, genres=None, most_type=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/movies/played/%s' % ('weekly' if not most_type else most_type),
|
|
|
|
url='https://api.trakt.tv/movies/played/%s' % ('weekly' if not most_type else most_type),
|
|
|
@ -532,6 +545,7 @@ class Trakt:
|
|
|
|
genres=genres
|
|
|
|
genres=genres
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache(cache_file='cache.db', retry_if_blank=True)
|
|
|
|
def get_most_watched_movies(self, limit=1000, languages=None, genres=None, most_type=None):
|
|
|
|
def get_most_watched_movies(self, limit=1000, languages=None, genres=None, most_type=None):
|
|
|
|
return self._make_items_request(
|
|
|
|
return self._make_items_request(
|
|
|
|
url='https://api.trakt.tv/movies/watched/%s' % ('weekly' if not most_type else most_type),
|
|
|
|
url='https://api.trakt.tv/movies/watched/%s' % ('weekly' if not most_type else most_type),
|
|
|
|