mirror of
https://github.com/nwithan8/plex-prerolls
synced 2024-08-30 16:52:17 +00:00
- Improve logging for disable_always
This commit is contained in:
parent
a8d3cf69d4
commit
07dd14fd64
@ -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:
|
||||
@ -23,11 +23,13 @@ class PlexConnector:
|
||||
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
|
||||
|
@ -152,7 +152,7 @@ class ScheduleManager:
|
||||
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}
|
||||
|
Loading…
Reference in New Issue
Block a user