diff --git a/trakt/__version__.py b/trakt/__version__.py index 4f7facb8..e1f88202 100644 --- a/trakt/__version__.py +++ b/trakt/__version__.py @@ -1 +1 @@ -__version__ = "Unknown" +__version__ = "alpha" diff --git a/trakt/sync.py b/trakt/sync.py index 4af3a3d9..3537beb2 100644 --- a/trakt/sync.py +++ b/trakt/sync.py @@ -9,7 +9,7 @@ from trakt.utils import slugify, timestamp __author__ = 'Jon Nappi' -__all__ = ['Scrobbler', 'comment', 'rate', 'add_to_history', 'get_collection', +__all__ = ['Scrobbler', 'comment', 'rate', 'get_history', 'add_to_history', 'get_collection', 'get_watchlist', 'add_to_watchlist', 'remove_from_history', 'remove_from_watchlist', 'add_to_collection', 'remove_from_collection', 'search', 'search_by_id', 'checkin_media', @@ -409,6 +409,23 @@ def get_watched(list_type=None, extended=None): yield results +@get +def get_history(media): + """ + Retrieve a :class:`Movie`, :class:`TVShow`, or :class:`TVEpisode + from your history. + + :param media: Supports both the PyTrakt :class:`Movie`, + :class:`TVShow`, etc. But also supports passing custom json structures. + """ + + uri = 'sync/history' + uri += f'/{media.media_type}/{media.trakt}' + + results = yield uri + yield results + + @get def get_collection(list_type=None, extended=None): """ diff --git a/trakt/tv.py b/trakt/tv.py index 91db5b58..381a0e06 100644 --- a/trakt/tv.py +++ b/trakt/tv.py @@ -18,7 +18,7 @@ __all__ = ['dismiss_recommendation', 'get_recommended_shows', 'genres', 'popular_shows', 'trending_shows', 'updated_shows', 'recommended_shows', 'played_shows', 'watched_shows', - 'collected_shows', 'anticipated_shows', 'TVShow', 'TVEpisode', + 'collected_shows', 'anticipated_shows', 'studios', 'TVShow', 'TVEpisode', 'TVSeason', 'Translation'] @@ -201,6 +201,20 @@ def anticipated_shows(page=1, limit=10, extended=None): data = yield uri yield [TVShow(**show['show']) for show in data] +@get +def studios(tvshow): + """ + Check :class:`TVShow`' for published studios + as well the title can be passed directly. + """ + if isinstance(tvshow, TVShow): + title = tvshow.slug + + uri = f'shows/{title}/studios' + + data = yield uri + yield data + class TVShow(IdsMixin): """A Class representing a TV Show object.""" @@ -341,7 +355,7 @@ def progress(self): The next_episode will be the next episode the user should collect, if there are no upcoming episodes it will be set to null. """ - return self._progress('collection') + return self._progress('watched') @get def collection_progress(self, **kwargs):