fix: NFO timestamp consistency and enhanced episode processing debug

NFO Management Timestamp Fix:
- Fix NFO management comments to use local timezone instead of UTC
- Both movie and TV episode NFO files now show consistent local timezone
- Comments now show: <!-- managed by NFOGuard at 2025-09-14T09:29:06-04:00 -->

Enhanced Episode Processing Debug:
- Add comprehensive debug logging for webhook episode database lookups
- Track IMDb ID and season/episode info throughout processing pipeline
- Add database write verification to catch storage issues immediately
- Enhanced logging will help identify duplicate processing root causes

This addresses the issue where episodes were being treated as new downloads
instead of finding existing database entries, helping prevent duplicate processing.
This commit is contained in:
2025-09-14 10:27:05 -04:00
parent 7af7b1c43e
commit d8754e41a7
4 changed files with 51 additions and 9 deletions
+5 -3
View File
@@ -9,7 +9,7 @@ from datetime import datetime, timezone
from typing import Optional, Dict, Any
import xml.etree.ElementTree as ET
from core.logging import _log
from core.logging import _log, _get_local_timezone
class NFOManager:
@@ -194,7 +194,8 @@ class NFOManager:
# Add footer comments with timestamp
self._strip_existing_footer_comments(root)
current_time = datetime.now(timezone.utc).isoformat(timespec="seconds")
local_tz = _get_local_timezone()
current_time = datetime.now(local_tz).isoformat(timespec="seconds")
root.append(ET.Comment(f" source: Movie; {source_detail} "))
root.append(ET.Comment(f" managed by {self.manager_brand} at {current_time} "))
@@ -289,7 +290,8 @@ class NFOManager:
# Add source comments with timestamp
if source_detail:
current_time = datetime.now(timezone.utc).isoformat(timespec="seconds")
local_tz = _get_local_timezone()
current_time = datetime.now(local_tz).isoformat(timespec="seconds")
xml_lines.append(f" <!-- source: TV Episode; {source_detail} -->")
xml_lines.append(f" <!-- managed by {self.manager_brand} at {current_time} -->")