Skip to content

Commit

Permalink
Return responses of Scrobble methods
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Jan 30, 2022
1 parent 8a6d4f1 commit 350a530
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions trakt/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,15 @@ def __init__(self, media, progress, app_version, app_date):

def start(self):
"""Start scrobbling this :class:`Scrobbler`'s *media* object"""
self._post('scrobble/start')
return self._post('scrobble/start')

def pause(self):
"""Pause the scrobbling of this :class:`Scrobbler`'s *media* object"""
self._post('scrobble/pause')
return self._post('scrobble/pause')

def stop(self):
"""Stop the scrobbling of this :class:`Scrobbler`'s *media* object"""
self._post('scrobble/stop')
return self._post('scrobble/stop')

def finish(self):
"""Complete the scrobbling this :class:`Scrobbler`'s *media* object"""
Expand All @@ -477,7 +477,7 @@ def update(self, progress):
object
"""
self.progress = progress
self.start()
return self.start()

@post
def _post(self, uri):
Expand All @@ -488,7 +488,8 @@ def _post(self, uri):
payload = dict(progress=self.progress, app_version=self.version,
date=self.date)
payload.update(self.media.to_json_singular())
yield uri, payload
response = yield uri, payload
yield response

def __enter__(self):
"""Context manager support for `with Scrobbler` syntax. Begins
Expand Down

0 comments on commit 350a530

Please sign in to comment.