Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
requests>=2.25
deprecated~=1.2.13
requests-oauthlib>=1.3
requests>=2.25
22 changes: 16 additions & 6 deletions trakt/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,18 @@ def search_by_id(query, id_type='imdb', media_type=None, slugify_query=False):
@get
def get_watchlist(list_type=None, sort=None):
"""
Get a watchlist.

Returns all items in a user's watchlist filtered by type.
optionally with a filter for a specific item type.

The watchlist should not be used as a list
of what the user is actively watching.

:param list_type: Optional Filter by a specific type.
Possible values: movies, shows, seasons or episodes.
:param sort: Optional sort. Only if the type is also sent.
Possible values: rank, added, released or title.

https://trakt.docs.apiary.io/#reference/sync/get-watchlist/get-watchlist
"""
valid_type = ('movies', 'shows', 'seasons', 'episodes')
valid_sort = ('rank', 'added', 'released', 'title')
Expand Down Expand Up @@ -346,18 +351,23 @@ def get_watchlist(list_type=None, sort=None):

@get
def get_watched(list_type=None, extended=None):
"""Return all movies or shows a user has watched sorted by most plays.
"""Returns all movies or shows a user has watched sorted by most plays.

If type is set to shows and you add ?extended=noseasons to the URL,
it won't return season or episode info.

:param list_type: Optional Filter by a specific type.
Possible values: movies, shows, seasons or episodes.
Possible values: movies, shows.
:param extended: Optional value for requesting extended information.

https://trakt.docs.apiary.io/#reference/sync/get-watched/get-watched
"""
valid_type = ('movies', 'shows', 'seasons', 'episodes')
valid_type = ('movies', 'shows')

if list_type and list_type not in valid_type:
raise ValueError('list_type must be one of {}'.format(valid_type))

uri = 'sync/watchlist'
uri = 'sync/watched'
if list_type:
uri += '/{}'.format(list_type)

Expand Down