Use ScrobblerProxy directly in ScrobblerCollection
from plextraktsync.events import (ActivityNotification, Error,
PlaySessionStateNotification, TimelineEntry)
from plextraktsync.factory import factory, logging
+from plextraktsync.trakt.ScrobblerProxy import ScrobblerProxy
if TYPE_CHECKING:
from typing import Union
@@ -26,9 +27,12 @@ def __init__(self, trakt: TraktApi, threshold=80):
self.trakt = trakt
self.threshold = threshold
- def __missing__(self, key: Union[Movie, TVEpisode]):
- self[key] = value = self.trakt.scrobbler(key, self.threshold)
- return value
+ def __missing__(self, media: Union[Movie, TVEpisode]):
+ scrobbler = media.scrobble(0, None, None)
+ proxy = ScrobblerProxy(scrobbler, self.threshold)
+ self[media] = proxy
+
+ return proxy
class SessionCollection(dict):
