From ffaf1bfee84353839d9dae8dac38b15260afaeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 12 Jan 2022 22:20:31 +0200 Subject: [PATCH 1/2] Add Sync class --- trakt/sync.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/trakt/sync.py b/trakt/sync.py index c4bf7cfe..81143cce 100644 --- a/trakt/sync.py +++ b/trakt/sync.py @@ -431,6 +431,13 @@ def delete_checkin(): yield "checkin" +class Sync(object): + """Container for Sync operations""" + + def __init__(self): + super(Sync, self).__init__() + + class Scrobbler(object): """Scrobbling is a seemless and automated way to track what you're watching in a media center. This class allows the media center to easily send From 64c1ac81e9fb1fa9a027a47b6e3ffec887a9f5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 12 Jan 2022 22:20:43 +0200 Subject: [PATCH 2/2] Add Sync.watched_shows method --- trakt/sync.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/trakt/sync.py b/trakt/sync.py index 81143cce..60ceda52 100644 --- a/trakt/sync.py +++ b/trakt/sync.py @@ -437,6 +437,23 @@ class Sync(object): def __init__(self): super(Sync, self).__init__() + @staticmethod + def _watched(watch_type): + uri = f'sync/watched/{watch_type}' + + data = yield uri + + yield data + + @get + def watched_shows(self): + """ + Returns all shows a user has watched sorted by most plays. + + https://trakt.docs.apiary.io/#reference/sync/get-watched/get-watched + """ + return self._watched('shows') + class Scrobbler(object): """Scrobbling is a seemless and automated way to track what you're watching