Use RunConfig for parameters
MODIFY
plextraktsync/commands/sync.py
plextraktsync/commands/sync.py
@@ -91,10 +91,11 @@ def sync(
movies = sync_option in ["all", "movies"]
shows = sync_option in ["all", "tv", "shows"]
+ config = factory.run_config().update(batch_size=batch_size, dry_run=dry_run, progressbar=not no_progress_bar)
plex = factory.plex_api()
- trakt = factory.trakt_api(batch_size=batch_size)
- mf = factory.media_factory(batch_size=batch_size)
- pb = factory.progressbar(not no_progress_bar)
+ trakt = factory.trakt_api()
+ mf = factory.media_factory()
+ pb = factory.progressbar(config.progressbar)
wc = WalkConfig(movies=movies, shows=shows)
w = Walker(plex=plex, trakt=trakt, mf=mf, config=wc, progressbar=pb)

MODIFY
plextraktsync/commands/unmatched.py
plextraktsync/commands/unmatched.py
@@ -18,11 +18,12 @@ def unmatched(no_progress_bar: bool):
List media that has no match in Plex
"""
+ config = factory.run_config().update(progressbar=not no_progress_bar)
ensure_login()
plex = factory.plex_api()
trakt = factory.trakt_api()
mf = factory.media_factory()
- pb = factory.progressbar(not no_progress_bar)
+ pb = factory.progressbar(config.progressbar)
wc = WalkConfig()
walker = Walker(plex, trakt, mf, wc, progressbar=pb)

MODIFY
plextraktsync/factory.py
plextraktsync/factory.py
class Factory:
@memoize
- def trakt_api(self, batch_size=None):
+ def trakt_api(self):
from plextraktsync.trakt_api import TraktApi
- trakt = TraktApi(batch_size=batch_size)
+ config = self.run_config()
+ trakt = TraktApi(batch_size=config.batch_size)
return trakt
@@ -21,10 +22,10 @@ def plex_api(self):
return plex
@memoize
- def media_factory(self, batch_size=None):
+ def media_factory(self):
from plextraktsync.media import MediaFactory
- trakt = self.trakt_api(batch_size=batch_size)
+ trakt = self.trakt_api()
plex = self.plex_api()
mf = MediaFactory(plex, trakt)
@@ -80,6 +81,14 @@ def progressbar(self, enabled=True):
return None
+ @memoize
+ def run_config(self):
+ from plextraktsync.config import RunConfig
+
+ config = RunConfig()
+
+ return config
+
@memoize
def config(self):
from plextraktsync.config import CONFIG

Use RunConfig for parameters