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>
This commit is contained in:
2025-09-14 09:56:27 -04:00
parent 5c7300fc74
commit 7af7b1c43e
7 changed files with 113 additions and 31 deletions
+14 -4
View File
@@ -231,22 +231,32 @@ Preserve movie and TV import dates in Emby/Jellyfin/Plex by preventing upgraded
- **Consistent Import**: All client modules now use centralized `core.logging._log`
**🏆 User Experience Improvements:**
- **Consistent Timestamps**: All logs now show the same timezone format
- **Easier Troubleshooting**: Timestamps match user's local environment
- **Consistent Timestamps**: All logs AND NFO files now show the same timezone format
- **Easier Troubleshooting**: Timestamps match user's local environment everywhere
- **No More Confusion**: No need to mentally convert between UTC and local time
- **Production Ready**: Robust fallbacks ensure logging works in all environments
- **Production Ready**: Robust fallbacks ensure timezone handling works in all environments
- **NFO File Accuracy**: Movie and TV episode `<dateadded>` fields now respect container timezone
**📋 Before/After Example:**
```
# Before (Inconsistent)
sonarr-nfo-cache | [2025-09-14T09:37:00.338045] DEBUG: Mapped Radarr path...
sonarr-nfo-cache | [2025-09-14T13:37:00+00:00] INFO: Batched movie webhook...
<dateadded>2025-09-14T13:49:00+00:00</dateadded> <!-- UTC in NFO files -->
# After (Consistent)
sonarr-nfo-cache | [2025-09-14T09:37:00-04:00] DEBUG: Mapped Radarr path...
sonarr-nfo-cache | [2025-09-14T09:37:00-04:00] INFO: Batched movie webhook...
<dateadded>2025-09-14T09:49:00-04:00</dateadded> <!-- Local timezone in NFO files -->
```
**🔧 Additional NFO Timezone Fixes:**
- **Movie Import Dates**: Convert UTC timestamps from Radarr to local timezone in NFO files
- **TV Episode Downloads**: Webhook-triggered episodes now use local time for `<dateadded>`
- **File Modification Times**: Fallback file mtime dates now respect container timezone
- **Historical Date Preservation**: `<aired>` and `<premiered>` dates remain historically accurate
- **Centralized Logging**: All modules now use consistent timezone-aware logging system
---
## 📝 Development Workflow Instructions
@@ -260,5 +270,5 @@ sonarr-nfo-cache | [2025-09-14T09:37:00-04:00] INFO: Batched movie webhook...
---
**Last Updated:** September 14, 2025
**Version:** v0.6.4
**Version:** v0.6.5
**Status:** Enhanced Production Ready