This commit is contained in:
+26
-4
@@ -156,8 +156,19 @@ class NFOManager:
|
|||||||
|
|
||||||
# Consider it NFOGuard-managed if it has lockdata=true (with or without dateadded)
|
# Consider it NFOGuard-managed if it has lockdata=true (with or without dateadded)
|
||||||
if lockdata_elem is not None and lockdata_elem.text == "true":
|
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'<!--\s*NFOGuard\s*-\s*Source:\s*([^-]+?)\s*-->', nfo_content)
|
||||||
|
if source_match:
|
||||||
|
source = source_match.group(1).strip()
|
||||||
|
print(f"🔍 Extracted original source from NFO comment: {source}")
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
"source": "nfo_file_existing"
|
"source": source
|
||||||
}
|
}
|
||||||
|
|
||||||
if dateadded_elem is not None and dateadded_elem.text:
|
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:
|
if aired_elem is not None and aired_elem.text:
|
||||||
result["aired"] = aired_elem.text.strip()
|
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
|
return result
|
||||||
|
|
||||||
except (ET.ParseError, Exception) as e:
|
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)
|
# Consider it NFOGuard-managed if it has lockdata=true (with or without dateadded)
|
||||||
if lockdata_elem is not None and lockdata_elem.text == "true":
|
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'<!--\s*NFOGuard\s*-\s*Source:\s*([^-]+?)\s*-->', nfo_content)
|
||||||
|
if source_match:
|
||||||
|
source = source_match.group(1).strip()
|
||||||
|
print(f"🔍 Extracted original source from episode NFO comment: {source}")
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
"source": "episode_nfo_existing"
|
"source": source
|
||||||
}
|
}
|
||||||
|
|
||||||
if dateadded_elem is not None and dateadded_elem.text:
|
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:
|
if aired_elem is not None and aired_elem.text:
|
||||||
result["aired"] = aired_elem.text.strip()
|
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
|
return result
|
||||||
|
|
||||||
except (ET.ParseError, Exception) as e:
|
except (ET.ParseError, Exception) as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user