Skip to content

Commit

Permalink
- Improve logging for disable_always
Browse files Browse the repository at this point in the history
  • Loading branch information
nwithan8 committed Dec 14, 2023
1 parent a8d3cf6 commit 07dd14f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions modules/plex_connector.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from typing import List, Union
from typing import List, Union, Tuple

from plexapi.server import PlexServer

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:
return None
return None, 0

# Filter out empty paths
paths = [path for path in paths if path]

return ";".join(paths)
return ";".join(paths), len(paths)


class PlexConnector:
Expand All @@ -23,11 +23,13 @@ def __init__(self, host: str, token: str):
self._plex_server = PlexServer(baseurl=self._host, token=self._token)

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:
logging.info("No pre-roll paths to update")
return

logging.info(f"Using {count} pre-roll paths")

if testing:
logging.debug(f"Testing: Would have updated pre-roll to: {pre_roll_string}")
return
Expand Down
2 changes: 1 addition & 1 deletion modules/schedule_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def valid_schedule_count(self) -> int:
def valid_schedule_count_log_message(self) -> str:
return f"""
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}
Weekly - {self.valid_weekly_schedule_count}
{self.valid_weekly_schedule_log_message}
Expand Down

0 comments on commit 07dd14f

Please sign in to comment.