Commit Graph

9 Commits

Author SHA1 Message Date
sbcrumb 7af7b1c43e feat: complete timezone support for NFO dateadded fields
- Fix NFO dateadded timestamps to use local timezone instead of UTC
- Convert Radarr/Sonarr import dates from UTC to local timezone for NFO files
- Update webhook episode processing to use local time for new downloads
- Convert file modification time fallbacks to local timezone
- Preserve historical dates (aired, premiered) in original UTC format
- Replace all placeholder logging functions with centralized timezone-aware logging
- Add convert_utc_to_local() utility function for timestamp conversion
- Now all logs AND NFO files show consistent local timezone formatting

Users with TZ=America/New_York will now see:
- Logs: [2025-09-14T09:37:00-04:00]
- NFO files: <dateadded>2025-09-14T09:37:00-04:00</dateadded>
2025-09-14 09:56:27 -04:00
sbcrumb f4c56f6cbe 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)
2025-09-13 19:52:43 -04:00
sbcrumb f998a64cdb update f string 2025-09-13 19:23:16 -04:00
sbcrumb 4ef28c3021 updates 2025-09-12 13:54:29 -04:00
sbcrumb dcbb25ca9e Fix Emby TV episode date handling by using <aired> field for import dates
- Issue: Emby displays DateCreated field which gets updated on metadata refresh
- Root cause: Emby ignores <dateadded> but reads <aired> for TV episodes
- Solution: Write import date to <aired> field instead of actual air date
- Emby will now display import date (Feb 19) instead of scan date (Sep 11)
- Maintains backward compatibility with fallback to actual air date
2025-09-11 16:45:36 -04:00
sbcrumb aff6179ddb Fix missing typing imports in NFOManager
🐛 Fix:
• Add missing Dict, Any imports from typing module
• Resolves NameError: name 'Dict' is not defined
2025-09-11 09:46:23 -04:00
sbcrumb c705fb4d6d Add comprehensive TV show enhancements and URL-safe endpoints
 Features Added:
• Single season/episode processing capability via new endpoints
• Enhanced NFO generation with full Sonarr API metadata (titles, plots, ratings)
• NFOGuard timestamp tracking in all NFO source comments
• URL-safe /tv/scan-season and /tv/scan-episode endpoints

🔧 Technical Improvements:
• Fixed URL encoding issues for paths with spaces and special characters
• Enhanced TVProcessor with process_season() and process_episode_file() methods
• Rich metadata extraction from Sonarr API (episode titles, plots, runtime, ratings)
• XML escaping for special characters in metadata
• Comprehensive episode parsing (SxxExx and numeric formats)

📚 Documentation:
• Updated README with new TV processing endpoints
• Added enhanced NFO generation examples showing before/after
• Documented URL-safe alternatives to manual scan paths

🎯 User Benefits:
• Can now process single seasons: Chicago Fire Season 13
• Can now process single episodes: S13E21 files
• Enhanced NFO files with full episode metadata for better Emby/Plex experience
• Timestamps show when NFOGuard processed each file
2025-09-11 09:39:42 -04:00
sbcrumb afe93b4a8a imdb updates 2025-09-09 17:13:14 -04:00
sbcrumb f73875acdd refactor 2025-09-08 10:05:04 -04:00