debug optional

This commit is contained in:
2025-09-22 12:18:40 -04:00
parent 3e5c80279f
commit c04fe8d083
3 changed files with 11 additions and 12 deletions
+1 -1
View File
@@ -1 +1 @@
1.6.8 1.6.9
+4 -5
View File
@@ -14,8 +14,9 @@ import re
class NFOManager: class NFOManager:
"""Manages NFO file creation and updates""" """Manages NFO file creation and updates"""
def __init__(self, manager_brand: str = "NFOGuard"): def __init__(self, manager_brand: str = "NFOGuard", debug: bool = False):
self.manager_brand = manager_brand self.manager_brand = manager_brand
self.debug = debug
def parse_imdb_from_path(self, path: Path) -> Optional[str]: def parse_imdb_from_path(self, path: Path) -> Optional[str]:
"""Extract IMDb ID from directory path or filename""" """Extract IMDb ID from directory path or filename"""
@@ -422,12 +423,9 @@ class NFOManager:
try: try:
# First, check for existing long-named NFO files that need migration # First, check for existing long-named NFO files that need migration
existing_long_nfo = self.find_existing_episode_nfo(season_dir, season_num, episode_num) existing_long_nfo = self.find_existing_episode_nfo(season_dir, season_num, episode_num)
print(f" 🔍 Debug: existing_long_nfo = {existing_long_nfo}")
print(f" 🔍 Debug: nfo_path.exists() = {nfo_path.exists()}")
# Prioritize long-named file for migration, otherwise use standard file # Prioritize long-named file for migration, otherwise use standard file
source_nfo_path = existing_long_nfo if existing_long_nfo else nfo_path if nfo_path.exists() else None source_nfo_path = existing_long_nfo if existing_long_nfo else nfo_path if nfo_path.exists() else None
print(f" 🔍 Debug: source_nfo_path = {source_nfo_path}")
if source_nfo_path: if source_nfo_path:
try: try:
@@ -470,7 +468,8 @@ class NFOManager:
# Important: DO NOT remove content fields like title, plot, runtime, premiered, etc. # Important: DO NOT remove content fields like title, plot, runtime, premiered, etc.
# These should be preserved from the long-named NFO files # These should be preserved from the long-named NFO files
# Debug: Show what fields are preserved after removing NFOGuard fields # Debug: Show what fields are preserved after removing NFOGuard fields (if DEBUG enabled)
if self.debug:
preserved_fields = [elem.tag for elem in episode] preserved_fields = [elem.tag for elem in episode]
if preserved_fields: if preserved_fields:
print(f" 🔍 Content preserved after cleanup: {', '.join(preserved_fields)}") print(f" 🔍 Content preserved after cleanup: {', '.join(preserved_fields)}")
+1 -1
View File
@@ -1413,7 +1413,7 @@ start_time = datetime.now(timezone.utc)
# Initialize components # Initialize components
db = NFOGuardDatabase(config.db_path) db = NFOGuardDatabase(config.db_path)
nfo_manager = NFOManager(config.manager_brand) nfo_manager = NFOManager(config.manager_brand, config.debug)
path_mapper = PathMapper(config) # FIXED: Pass config to PathMapper path_mapper = PathMapper(config) # FIXED: Pass config to PathMapper
tv_processor = TVProcessor(db, nfo_manager, path_mapper) tv_processor = TVProcessor(db, nfo_manager, path_mapper)
movie_processor = MovieProcessor(db, nfo_manager, path_mapper) movie_processor = MovieProcessor(db, nfo_manager, path_mapper)