From 56687c99dbbdb88a8c70a30188871e6666ad8a11 Mon Sep 17 00:00:00 2001 From: Chaz Larson Date: Fri, 21 Jul 2023 22:12:23 +0000 Subject: [PATCH 1/3] Report plex and platform details in the log --- modules/plex.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/plex.py b/modules/plex.py index ecffd69e..861164e4 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -441,13 +441,18 @@ class Plex(Library): self.PlexServer = PlexServer(baseurl=self.url, token=self.token, session=self.config.session, timeout=self.timeout) plexapi.server.TIMEOUT = self.timeout os.environ["PLEXAPI_PLEXAPI_TIMEOUT"] = str(self.timeout) + logger.info(f"Connected to server {self.PlexServer.friendlyName} version {self.PlexServer.version}") + logger.info(f"Running on {self.PlexServer.platform} version {self.PlexServer.platformVersion}") except Unauthorized: + logger.info(f"Plex Error: Plex connection attempt returned 'Unauthorized'") raise Failed("Plex Error: Plex token is invalid") except ValueError as e: + logger.info(f"Plex Error: Plex connection attempt returned 'ValueError'") raise Failed(f"Plex Error: {e}") except (requests.exceptions.ConnectionError, ParseError): + logger.info(f"Plex Error: Plex connection attempt returned 'ConnectionError' or 'ParseError'") logger.stacktrace() - raise Failed("Plex Error: Plex url is invalid") + raise Failed("Plex Error: Plex URL is probably invalid") self.Plex = None library_names = [] for s in self.PlexServer.library.sections(): From f4c4b4a880a6fee30a48e3a417a9caf9906ed2ec Mon Sep 17 00:00:00 2001 From: Chaz Larson Date: Sat, 22 Jul 2023 00:07:24 +0000 Subject: [PATCH 2/3] Log a couple more things on the server --- modules/plex.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/plex.py b/modules/plex.py index 861164e4..2d48960d 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -443,6 +443,17 @@ class Plex(Library): os.environ["PLEXAPI_PLEXAPI_TIMEOUT"] = str(self.timeout) logger.info(f"Connected to server {self.PlexServer.friendlyName} version {self.PlexServer.version}") logger.info(f"Running on {self.PlexServer.platform} version {self.PlexServer.platformVersion}") + myAcct = self.PlexServer.myPlexAccount() + pp_str = "No PlexPass" + if 'plexpass' in myAcct.roles: + pp_str = f"PlexPass is active" + srv_settings = self.PlexServer.settings + uc_str = f"Unknown update channel." + if srv_settings.get("butlerUpdateChannel").value == '16': + uc_str = f"Public update channel." + elif srv_settings.get("butlerUpdateChannel").value == '8': + uc_str = f"PlexPass update channel." + logger.info(f"{pp_str} on {uc_str}") except Unauthorized: logger.info(f"Plex Error: Plex connection attempt returned 'Unauthorized'") raise Failed("Plex Error: Plex token is invalid") From 361d9ee1507f0c0e8a62e77e4928abc6e0cf8062 Mon Sep 17 00:00:00 2001 From: Chaz Larson Date: Sat, 22 Jul 2023 00:26:31 +0000 Subject: [PATCH 3/3] Add a little library info --- modules/plex.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/plex.py b/modules/plex.py index 2d48960d..15230837 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -443,10 +443,7 @@ class Plex(Library): os.environ["PLEXAPI_PLEXAPI_TIMEOUT"] = str(self.timeout) logger.info(f"Connected to server {self.PlexServer.friendlyName} version {self.PlexServer.version}") logger.info(f"Running on {self.PlexServer.platform} version {self.PlexServer.platformVersion}") - myAcct = self.PlexServer.myPlexAccount() - pp_str = "No PlexPass" - if 'plexpass' in myAcct.roles: - pp_str = f"PlexPass is active" + pp_str = f"PlexPass: {self.PlexServer.myPlexSubscription}" srv_settings = self.PlexServer.settings uc_str = f"Unknown update channel." if srv_settings.get("butlerUpdateChannel").value == '16': @@ -454,6 +451,7 @@ class Plex(Library): elif srv_settings.get("butlerUpdateChannel").value == '8': uc_str = f"PlexPass update channel." logger.info(f"{pp_str} on {uc_str}") + logger.info(f"Scheduled maintenance running between {srv_settings.get('butlerStartHour').value}:00 and {srv_settings.get('butlerEndHour').value}:00") except Unauthorized: logger.info(f"Plex Error: Plex connection attempt returned 'Unauthorized'") raise Failed("Plex Error: Plex token is invalid") @@ -484,6 +482,10 @@ class Plex(Library): self._all_items = [] self._account = None self.agent = self.Plex.agent + self.scanner = self.Plex.scanner + for stg in self.Plex.settings(): + if stg.id == 'ratingsSource': + self.ratings_source = stg.value self.is_movie = self.type == "Movie" self.is_show = self.type == "Show" self.is_music = self.type == "Artist" @@ -493,6 +495,9 @@ class Plex(Library): if not self.is_music and self.update_blank_track_titles: self.update_blank_track_titles = False logger.error(f"update_blank_track_titles library operation only works with music libraries") + logger.info(f"Connected to library {params['name']}") + logger.info(f"Agent: {self.agent}; Scanner: {self.scanner}; ratings source: {self.ratings_source}") + exit() def notify(self, text, collection=None, critical=True): self.config.notify(text, server=self.PlexServer.friendlyName, library=self.name, collection=collection, critical=critical)