Update scripts/config_manager.py
All checks were successful
Generate M3U Playlist / build (push) Successful in 1m34s
All checks were successful
Generate M3U Playlist / build (push) Successful in 1m34s
This commit is contained in:
parent
e83930d6e9
commit
3c1e14558f
1 changed files with 24 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Configuration Manager - Handles all configuration loading and management
|
||||
Configuration Manager - FIXED for correct file paths
|
||||
"""
|
||||
|
||||
import json
|
||||
|
@ -8,19 +8,23 @@ import logging
|
|||
from pathlib import Path
|
||||
|
||||
class ConfigManager:
|
||||
"""Centralized configuration management."""
|
||||
"""Centralized configuration management with FIXED paths."""
|
||||
|
||||
def __init__(self, config_dir="config"):
|
||||
self.config_dir = Path(config_dir)
|
||||
# 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.mkdir(exist_ok=True)
|
||||
|
||||
# File paths
|
||||
self.channels_file = "channels.txt"
|
||||
self.playlist_file = "playlist.m3u"
|
||||
self.import_file = "bulk_import.m3u"
|
||||
self.log_file = "playlist_update.log"
|
||||
# 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")
|
||||
|
||||
# Config files
|
||||
# Config files in config subdirectory
|
||||
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"
|
||||
|
@ -30,7 +34,17 @@ class ConfigManager:
|
|||
self.patterns = self._load_patterns()
|
||||
self.group_overrides = self._load_group_overrides()
|
||||
|
||||
logging.info("Configuration manager initialized")
|
||||
# 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")
|
||||
|
||||
def _load_settings(self):
|
||||
"""Load settings with comprehensive defaults."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue