Pass shared Timer to trakt_batch partial
MODIFY
plextraktsync/factory.py
plextraktsync/factory.py
@@ -237,7 +237,7 @@ def trakt_batch(self):
return partial(
TraktBatch,
trakt=self.trakt_api,
- batch_delay=self.run_config.batch_delay,
+ timer=self.batch_delay_timer,
)

MODIFY
plextraktsync/trakt_api.py
plextraktsync/trakt_api.py
from plextraktsync.factory import factory, logger, logging
from plextraktsync.path import pytrakt_file
from plextraktsync.plex_api import PlexGuid, PlexLibraryItem
-from plextraktsync.timer import Timer
class ScrobblerProxy:
@@ -387,14 +386,14 @@ def trakt_batch(*args, **kwargs) -> TraktBatch:
class TraktBatch:
- def __init__(self, name: str, add: bool, trakt: TraktApi, batch_delay=None):
+ def __init__(self, name: str, add: bool, trakt: TraktApi, timer=None):
if name not in ["collection", "watchlist"]:
raise ValueError(f"TraktBatch name not allowed: {name}")
self.name = name
self.add = add
self.trakt = trakt
self.items = defaultdict(list)
- self.timer = Timer(batch_delay) if batch_delay else None
+ self.timer = timer
@nocache
@rate_limit()

Pass shared Timer to trakt_batch partial