Move get_plex_server to factory
MODIFY
plextraktsync/factory.py
plextraktsync/factory.py
@@ -33,9 +33,16 @@ def media_factory(self):
@memoize
def plex_server(self):
- from plextraktsync.plex_server import get_plex_server
+ config = self.config()
- return get_plex_server()
+ from plextraktsync.plex_server import PlexServerConnection
+ return PlexServerConnection(factory).connect(
+ urls=[
+ config["PLEX_BASEURL"],
+ config["PLEX_LOCALURL"],
+ ],
+ token=config["PLEX_TOKEN"]
+ )
@memoize
def session(self):

MODIFY
plextraktsync/plex_server.py
plextraktsync/plex_server.py
@@ -93,16 +93,3 @@ def save_new_url(self, base_url: str, local_url: str):
config["PLEX_LOCALURL"] = local_url
config.save()
logger.info("Plex server url changed to {}".format(base_url))
-
-
-def get_plex_server():
- from plextraktsync.factory import factory
- config = factory.config()
-
- return PlexServerConnection(factory).connect(
- urls=[
- config["PLEX_BASEURL"],
- config["PLEX_LOCALURL"],
- ],
- token=config["PLEX_TOKEN"]
- )

Move get_plex_server to factory