feat: smart NFO management and correct episode date field mapping

💾 Smart NFO File Management:
- Add intelligent content comparison to prevent unnecessary file overwrites
- Only update NFO files when content actually changes (ignoring timestamp differences)
- Dramatically reduce file system writes and improve scan performance
- Applied to both TV episodes and movies for comprehensive efficiency
- New _nfo_content_matches() method for smart content comparison

🗓️ Fix Episode Date Field Mapping:
- BREAKING: Correct date field usage in episode NFOs
- <aired> and <premiered>: Now use historical air dates (e.g., 1951-10-15)
- <dateadded>: Correctly shows actual download/import date (e.g., 2025-09-13)
- Resolves confusion between when show aired vs when user downloaded it
- Media servers now show historically accurate metadata with working "Recently Added"

🎯 Technical Changes:
- Enhanced create_episode_nfo() with content comparison logic
- Enhanced create_movie_nfo() with content comparison logic
- Separated historical date logic from import date logic
- Added comprehensive debug logging for file skip/update decisions

🏆 User Experience:
- Faster scans with fewer unnecessary file operations
- Correct historical context in media servers
- "Recently Added" functionality preserved and working
- No more metadata confusion between air dates and import dates

Example NFO output:
- <aired>1951-10-15</aired> (historical)
- <dateadded>2025-09-13T21:39:28+00:00</dateadded> (when downloaded)
- <premiered>1951-10-15</premiered> (historical)
This commit is contained in:
2025-09-13 19:52:43 -04:00
parent 2d89e87191
commit f4c56f6cbe
2 changed files with 107 additions and 13 deletions
+44 -1
View File
@@ -167,6 +167,49 @@ Preserve movie and TV import dates in Emby/Jellyfin/Plex by preventing upgraded
---
### 🆕 v0.6.3 NFO Management & Date Accuracy Improvements (September 2025)
**💾 Smart NFO File Management:**
- **Problem**: NFOguard was rewriting NFO files for every episode on every scan, even untouched ones
- **Solution**: Intelligent content comparison - only updates NFOs when content actually changes
- **Performance**: Dramatically reduces unnecessary file system writes and processing time
- **Both Media Types**: Applied to both TV episodes and movies for comprehensive efficiency
**🗓️ Correct Date Field Mapping:**
- **Problem**: Episode NFOs showing import dates (2025) for historical fields `<aired>` and `<premiered>`
- **Root Cause**: Logic incorrectly used `dateadded` for all date fields instead of proper separation
- **Fix**: Clear separation of date meanings:
- `<aired>`: Historical air date (e.g., 1951-10-15 for I Love Lucy)
- `<premiered>`: Historical premiere date (same as aired)
- `<dateadded>`: Actual download/import date (e.g., 2025-09-13T21:39:28+00:00)
**🎯 Technical Implementation:**
- **New Method**: `_nfo_content_matches()` - smart content comparison ignoring timestamps
- **Enhanced Logic**: Episodes now correctly separate historical vs import dates
- **Skip Logic**: Files marked "already up-to-date" when no meaningful changes detected
- **Logging**: Clear debug output showing when files are skipped vs updated
**🏆 User Experience Improvements:**
- **Correct Metadata**: Shows historically accurate air dates in media servers
- **Recently Added**: Still works properly using `dateadded` field
- **Performance**: Faster scans with fewer unnecessary file writes
- **Accuracy**: No more confusion between when show aired vs when you downloaded it
**📋 Example Before/After:**
```xml
<!-- Before (Wrong) -->
<aired>2025-09-13</aired> <!-- Import date in wrong field -->
<dateadded>2025-09-13T21:39:28+00:00</dateadded>
<premiered>2025-09-13</premiered> <!-- Import date in wrong field -->
<!-- After (Correct) -->
<aired>1951-10-15</aired> <!-- Historical air date ✅ -->
<dateadded>2025-09-13T21:39:28+00:00</dateadded> <!-- When downloaded ✅ -->
<premiered>1951-10-15</premiered> <!-- Historical premiere ✅ -->
```
---
**Last Updated:** September 13, 2025
**Version:** v0.6.2-dev
**Version:** v0.6.3-dev
**Status:** Enhanced Production Ready