- Improve logging for disable_always

This commit is contained in:
nwithan8 2023-12-14 01:06:45 -07:00
parent a8d3cf69d4
commit 07dd14fd64
2 changed files with 8 additions and 6 deletions

View File

@ -1,18 +1,18 @@
from typing import List, Union from typing import List, Union, Tuple
from plexapi.server import PlexServer from plexapi.server import PlexServer
import modules.logs as logging import modules.logs as logging
def prepare_pre_roll_string(paths: List[str]) -> Union[str, None]: def prepare_pre_roll_string(paths: List[str]) -> Tuple[Union[str, None], int]:
if not paths: if not paths:
return None return None, 0
# Filter out empty paths # Filter out empty paths
paths = [path for path in paths if path] paths = [path for path in paths if path]
return ";".join(paths) return ";".join(paths), len(paths)
class PlexConnector: class PlexConnector:
@ -23,11 +23,13 @@ class PlexConnector:
self._plex_server = PlexServer(baseurl=self._host, token=self._token) self._plex_server = PlexServer(baseurl=self._host, token=self._token)
def update_pre_roll_paths(self, paths: List[str], testing: bool = False) -> None: def update_pre_roll_paths(self, paths: List[str], testing: bool = False) -> None:
pre_roll_string = prepare_pre_roll_string(paths=paths) pre_roll_string, count = prepare_pre_roll_string(paths=paths)
if not pre_roll_string: if not pre_roll_string:
logging.info("No pre-roll paths to update") logging.info("No pre-roll paths to update")
return return
logging.info(f"Using {count} pre-roll paths")
if testing: if testing:
logging.debug(f"Testing: Would have updated pre-roll to: {pre_roll_string}") logging.debug(f"Testing: Would have updated pre-roll to: {pre_roll_string}")
return return

View File

@ -152,7 +152,7 @@ class ScheduleManager:
def valid_schedule_count_log_message(self) -> str: def valid_schedule_count_log_message(self) -> str:
return f""" return f"""
Valid Schedule Count: Valid Schedule Count:
Always - {self.valid_always_schedule_count} Always - {"Disabled by other schedule(s)" if self.disable_always else self.valid_always_schedule_count}
{self.valid_always_schedule_log_message} {self.valid_always_schedule_log_message}
Weekly - {self.valid_weekly_schedule_count} Weekly - {self.valid_weekly_schedule_count}
{self.valid_weekly_schedule_log_message} {self.valid_weekly_schedule_log_message}