Merge commit '3f43662c1f19056e81f107357b661b435ee3a876' into copilot/update-regex-replacement-strategy

This commit is contained in:
2025-12-02 10:16:44 +09:00
5 changed files with 28 additions and 52 deletions
+2 -1
View File
@@ -89,7 +89,8 @@ class ServerConfig:
self.schedule_weekly_days = config.get("schedule_weekly_days", [0])
self.schedule_weekly_time = config.get("schedule_weekly_time", "03:00")
self.schedule_auto_watch = config.get("schedule_auto_watch", False)
logger.info(f"Server config loaded: {self.__dict__}")
logger.info(f"Server config loaded.")
logger.debug(f"Current server config: {self.__dict__}")
def save(self):
config = {
+23 -1
View File
@@ -4,7 +4,29 @@ import os
LOG_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "logs", "app.log"))
LOG_LEVEL = logging.DEBUG
def _get_log_level():
"""Get log level from environment variable."""
level_str = os.getenv("LOG_LEVEL", "INFO").upper()
# Try to convert to integer
if level_str.isdigit():
return int(level_str)
# Map string to logging level
levels = {
"CRITICAL": logging.CRITICAL,
"FATAL": logging.FATAL,
"ERROR": logging.ERROR,
"WARN": logging.WARNING,
"WARNING": logging.WARNING,
"INFO": logging.INFO,
"DEBUG": logging.DEBUG,
"NOTSET": logging.NOTSET,
}
return levels.get(level_str, logging.INFO)
LOG_LEVEL = _get_log_level()
def logger_initialize() -> logging.Logger:
"""Initialize the logger for the application. Return a logger that logs to console and a app.log."""
+2
View File
@@ -159,6 +159,7 @@ def _read_text_if_exists(path: str) -> tuple[str, bool]:
def _save_playlist_to_folder(filename: str, paths: Sequence[str], folder: str) -> str:
_ensure_test_dir(folder)
file_path = os.path.join(folder, filename)
logger.info(f"Saving playlist to: {file_path}")
new_content = save_paths(paths)
@@ -585,6 +586,7 @@ def sync_all_playlists(
server_config.load()
compiled_rules = _compile_regex_rules(server_config.path_rules)
_ensure_test_dir(test_folder)
logger.info(f"Syncing playlists to test folder: {test_folder}")
local_playlists = _load_local_playlists(local_dir)
remote_playlists = _fetch_remote_playlists()
playlist_names: set[str] = set(local_playlists.keys())