Initialize plex_server via constructor parameter
This is to avoid dependency loop
MODIFY
plex_trakt_sync/main.py
plex_trakt_sync/main.py
@@ -435,10 +435,9 @@ def main():
logging.debug("Movie ratings from trakt: {}".format(ratings))
logging.info('Loaded Trakt lists.')
- plex = PlexApi()
- plex_server = plex.plex_server
-
with requests_cache.disabled():
+ plex_server = get_plex_server()
+ plex = PlexApi(plex_server)
logging.info("Server version {} updated at: {}".format(
plex_server.version, plex_server.updatedAt))
logging.info("Recently added: {}".format(

MODIFY
plex_trakt_sync/plex_api.py
plex_trakt_sync/plex_api.py
from plex_trakt_sync.decorators import memoize, nocache
-from plex_trakt_sync.main import get_plex_server
from plex_trakt_sync.config import CONFIG
@@ -8,11 +7,8 @@ class PlexApi:
Plex API class abstracting common data access and dealing with requests cache.
"""
- @property
- @memoize
- @nocache
- def plex_server(self):
- return get_plex_server()
+ def __init__(self, plex_server):
+ self.plex_server = plex_server
@property
@memoize

Initialize plex_server via constructor parameter

This is to avoid dependency loop