Change factory.run_config to property
MODIFY
plextraktsync/commands/sync.py
plextraktsync/commands/sync.py
@@ -28,7 +28,7 @@ def sync(
movies = sync_option in ["all", "movies"]
shows = sync_option in ["all", "tv", "shows"]
- config = factory.run_config().update(
+ config = factory.run_config.update(
server=server,
batch_delay=batch_delay,
dry_run=dry_run,

MODIFY
plextraktsync/commands/unmatched.py
plextraktsync/commands/unmatched.py
def unmatched(no_progress_bar: bool, local: bool):
- config = factory.run_config().update(progressbar=not no_progress_bar)
+ config = factory.run_config.update(progressbar=not no_progress_bar)
ensure_login()
plex = factory.plex_api
trakt = factory.trakt_api

MODIFY
plextraktsync/commands/watch.py
plextraktsync/commands/watch.py
@@ -219,7 +219,7 @@ def scrobble(self, m: Media, percent: float, event: PlaySessionStateNotification
def watch(server: str):
- factory.run_config().update(
+ factory.run_config.update(
server=server,
)
ws = factory.web_socket_listener

MODIFY
plextraktsync/factory.py
plextraktsync/factory.py
@@ -7,7 +7,7 @@ class Factory:
def trakt_api(self):
from plextraktsync.trakt_api import TraktApi
- config = self.run_config()
+ config = self.run_config
trakt = TraktApi(batch_delay=config.batch_delay)
return trakt
@@ -47,7 +47,7 @@ def server_config(self):
from plextraktsync.config.ServerConfig import ServerConfig
config = self.config()
- run_config = self.run_config()
+ run_config = self.run_config
server_config = ServerConfig()
server_name = run_config.server
@@ -94,7 +94,7 @@ def progressbar(self, enabled=True):
return None
- @memoize
+ @cached_property
def run_config(self):
from plextraktsync.config.RunConfig import RunConfig
@@ -120,7 +120,7 @@ def plex_audio_codec(self):
def walker(self):
from plextraktsync.walker import Walker
- config = self.run_config()
+ config = self.run_config
walk_config = self.walk_config()
plex = self.plex_api
trakt = self.trakt_api

Change factory.run_config to property