diff --git a/VERSION b/VERSION index 7d2ed7c..399088b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.4 +2.1.6 diff --git a/core/nfo_manager.py b/core/nfo_manager.py index 79f55b7..0fc13e6 100644 --- a/core/nfo_manager.py +++ b/core/nfo_manager.py @@ -156,8 +156,19 @@ class NFOManager: # Consider it NFOGuard-managed if it has lockdata=true (with or without dateadded) if lockdata_elem is not None and lockdata_elem.text == "true": + # Extract original source from NFOGuard comment, default to nfo_file_existing + source = "nfo_file_existing" + + # Parse XML content to find NFOGuard comment with source + nfo_content = nfo_path.read_text(encoding='utf-8') + import re + source_match = re.search(r'', nfo_content) + if source_match: + source = source_match.group(1).strip() + print(f"🔍 Extracted original source from NFO comment: {source}") + result = { - "source": "nfo_file_existing" + "source": source } if dateadded_elem is not None and dateadded_elem.text: @@ -169,7 +180,7 @@ class NFOManager: if aired_elem is not None and aired_elem.text: result["aired"] = aired_elem.text.strip() - print(f"✅ Found NFOGuard data in NFO: dateadded={result.get('dateadded', 'None')}, released={result.get('released', 'None')}, aired={result.get('aired', 'None')}") + print(f"✅ Found NFOGuard data in NFO: dateadded={result.get('dateadded', 'None')}, source={source}, released={result.get('released', 'None')}, aired={result.get('aired', 'None')}") return result except (ET.ParseError, Exception) as e: @@ -197,8 +208,19 @@ class NFOManager: # Consider it NFOGuard-managed if it has lockdata=true (with or without dateadded) if lockdata_elem is not None and lockdata_elem.text == "true": + # Extract original source from NFOGuard comment, default to episode_nfo_existing + source = "episode_nfo_existing" + + # Parse XML content to find NFOGuard comment with source + nfo_content = nfo_path.read_text(encoding='utf-8') + import re + source_match = re.search(r'', nfo_content) + if source_match: + source = source_match.group(1).strip() + print(f"🔍 Extracted original source from episode NFO comment: {source}") + result = { - "source": "episode_nfo_existing" + "source": source } if dateadded_elem is not None and dateadded_elem.text: @@ -207,7 +229,7 @@ class NFOManager: if aired_elem is not None and aired_elem.text: result["aired"] = aired_elem.text.strip() - print(f"✅ Found NFOGuard data in episode NFO S{season_num:02d}E{episode_num:02d}: dateadded={result.get('dateadded', 'None')}, aired={result.get('aired', 'None')}") + print(f"✅ Found NFOGuard data in episode NFO S{season_num:02d}E{episode_num:02d}: dateadded={result.get('dateadded', 'None')}, source={source}, aired={result.get('aired', 'None')}") return result except (ET.ParseError, Exception) as e: