Add progress property to ScrobblerProxy
On stop, if the progress is below threshold, use pause
MODIFY
plextraktsync/commands/watch.py
plextraktsync/commands/watch.py
@@ -106,7 +106,7 @@ def scrobble(self, m: Media, percent: float, event: PlaySessionStateNotification
return self.scrobblers[tm].pause()
if state == "stopped":
- self.scrobblers[tm].stop()
+ self.scrobblers[tm].stop(percent)
del self.scrobblers[tm]
del self.sessions[event.session_key]

MODIFY
plextraktsync/trakt_api.py
plextraktsync/trakt_api.py
@@ -26,8 +26,9 @@ class ScrobblerProxy:
Proxy to Scrobbler that handles requsts cache and rate limiting
"""
- def __init__(self, scrobbler: Scrobbler):
+ def __init__(self, scrobbler: Scrobbler, threshold=80):
self.scrobbler = scrobbler
+ self.threshold = threshold
@nocache
@rate_limit()
@@ -44,8 +45,11 @@ def pause(self):
@nocache
@rate_limit()
@time_limit()
- def stop(self):
+ def stop(self, progress: float):
+ if progress >= self.threshold:
self.scrobbler.stop()
+ else:
+ self.scrobbler.pause()
class TraktApi:

Add progress property to ScrobblerProxy

On stop, if the progress is below threshold, use pause