Skip to content

Commit

Permalink
Merge branch 'scrobble-response'
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Oct 24, 2022
2 parents edb257e + 350a530 commit a24cc57
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 @@ -459,15 +459,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 @@ -480,7 +480,7 @@ def update(self, progress):
object
"""
self.progress = progress
self.start()
return self.start()

@post
def _post(self, uri):
Expand All @@ -491,7 +491,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 a24cc57

Please sign in to comment.