Update scripts/config_manager.py
Some checks failed
Generate M3U Playlist / build (push) Has been cancelled
Some checks failed
Generate M3U Playlist / build (push) Has been cancelled
This commit is contained in:
parent
8cb336445c
commit
29fa395268
1 changed files with 13 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Configuration Manager - FIXED for correct file paths
|
||||
Configuration Manager - Handles all configuration loading and management
|
||||
"""
|
||||
|
||||
import json
|
||||
|
@ -8,23 +8,19 @@ import logging
|
|||
from pathlib import Path
|
||||
|
||||
class ConfigManager:
|
||||
"""Centralized configuration management with FIXED paths."""
|
||||
"""Centralized configuration management."""
|
||||
|
||||
def __init__(self, config_dir="config"):
|
||||
# Get the parent directory (go up from scripts/ to root)
|
||||
script_dir = Path(__file__).parent
|
||||
root_dir = script_dir.parent
|
||||
|
||||
self.config_dir = root_dir / config_dir
|
||||
self.config_dir = Path(config_dir)
|
||||
self.config_dir.mkdir(exist_ok=True)
|
||||
|
||||
# FIXED: File paths now point to root directory
|
||||
self.channels_file = str(root_dir / "channels.txt")
|
||||
self.playlist_file = str(root_dir / "playlist.m3u")
|
||||
self.import_file = str(root_dir / "bulk_import.m3u")
|
||||
self.log_file = str(root_dir / "playlist_update.log")
|
||||
# File paths
|
||||
self.channels_file = "channels.txt"
|
||||
self.playlist_file = "playlist.m3u"
|
||||
self.import_file = "bulk_import.m3u"
|
||||
self.log_file = "playlist_update.log"
|
||||
|
||||
# Config files in config subdirectory
|
||||
# Config files
|
||||
self.settings_file = self.config_dir / "settings.json"
|
||||
self.patterns_file = self.config_dir / "patterns.json"
|
||||
self.group_overrides_file = self.config_dir / "group_overrides.json"
|
||||
|
@ -34,17 +30,7 @@ class ConfigManager:
|
|||
self.patterns = self._load_patterns()
|
||||
self.group_overrides = self._load_group_overrides()
|
||||
|
||||
# Debug logging
|
||||
logging.info(f"Root directory: {root_dir}")
|
||||
logging.info(f"Config channels_file: {self.channels_file}")
|
||||
logging.info(f"Config import_file: {self.import_file}")
|
||||
logging.info(f"Config playlist_file: {self.playlist_file}")
|
||||
|
||||
# Check if files exist
|
||||
logging.info(f"bulk_import.m3u exists: {os.path.exists(self.import_file)}")
|
||||
logging.info(f"channels.txt exists: {os.path.exists(self.channels_file)}")
|
||||
|
||||
logging.info("Configuration manager initialized with FIXED paths")
|
||||
logging.info("Configuration manager initialized")
|
||||
|
||||
def _load_settings(self):
|
||||
"""Load settings with comprehensive defaults."""
|
||||
|
@ -62,7 +48,9 @@ class ConfigManager:
|
|||
"health_check_timeout": 5,
|
||||
"create_backup": True,
|
||||
"max_backups": 5,
|
||||
"log_level": "INFO"
|
||||
"log_level": "INFO",
|
||||
"clear_import_after_processing": True,
|
||||
"delete_import_file": False
|
||||
}
|
||||
|
||||
if self.settings_file.exists():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue