7.1 KiB
7.1 KiB
NFOGuard Project Summary
Project Overview
NFOGuard is a comprehensive solution to protect and preserve date metadata for TV shows and movies across Plex, Emby, and Jellyfin media servers. The core issue is that these servers often display scan dates instead of the original import dates from NFO files.
Core Problem
- TV episodes show scan dates instead of import dates in Emby
- Root Cause: Emby displays
DateCreatedfield, not NFO<dateadded> - Impact: Users lose track of when content was actually imported/acquired
Project Components
1. NFOGuard Core (Python) - v0.6.1 ✅
Status: Completed and working
- Processes TV shows and movies
- Writes import date from NFO
<dateadded>to<aired>field <aired>maps to Emby'sPremiereDatefield- Current Fix: Writing import date to
<aired>field (goes to PremiereDate)
2. NFOGuard Emby Plugin (C# DLL) - v1.0.0 🚧
Status: Built, ready for testing
- Purpose: Automatically sync
PremiereDate→DateCreatedin Emby - Approach: Real-time processing via library events (not scheduled tasks)
- Architecture: Clean, standards-compliant Emby plugin
What We've Tried
❌ Failed Approaches
- Direct NFO
<dateadded>reading - Emby ignores this field - Waiting for auto-sync - PremiereDate doesn't auto-sync to DateCreated
- Manual database updates - Too complex, risky
✅ Working Solutions
- NFOGuard Core: Successfully writes to
<aired>field - Plugin approach: Direct database updates via Emby API (
UpdateToRepository())
Current Implementation Status
NFOGuard Core Features ✅
- TV show processing with configurable webhook modes
- Movie processing
- NFO date field manipulation
- Comprehensive logging and error handling
- CI/CD pipeline with automated testing
Emby Plugin Features ✅ - READY FOR TESTING
- Real-time processing: Library event hooks (
ItemAdded/ItemUpdated) - Scheduled task mode: Weekly batch processing of existing episodes
- Flexible processing modes: Real-time only, scheduled only, or both
- Configuration UI: Full settings page in Emby dashboard
- TV episode detection: Automatic filtering and processing
- Core sync logic:
PremiereDate→DateCreatedsynchronization - Verbose logging: Configurable detailed logging for troubleshooting
- License framework: Ready for future licensing (currently disabled)
- Standard architecture: Follows official Emby plugin guidelines
Technical Details
Key Discovery from TimeLord Analysis
// Core sync operation (standard Emby API)
episode.DateCreated = episode.PremiereDate.Value;
episode.UpdateToRepository(ItemUpdateType.MetadataEdit);
Our Implementation
- Uses standard Emby interfaces:
ILibraryManager,IItemRepository - Event-driven processing vs TimeLord's scheduled tasks
- Clean dependency injection and configuration management
Development Environment
- Platform: Windows with WSL (Ubuntu)
- Build Tools: .NET SDK 6.0 in WSL
- Target Framework: .NET Framework 4.8
- IDE: VS Code in WSL
- Emby Server: Windows installation (can access DLLs directly)
Next Steps - Priority Order
Immediate (This Session) - ✅ COMPLETED
- ✅ Create project summary (this file)
- ✅ Get Emby SDK DLLs - From Windows Emby installation
- ✅ Build plugin - First compilation test SUCCESS!
- ✅ Disable licensing - For testing phase
- ✅ Add settings UI - Configuration page with options:
- ✅ Enable/disable real-time processing
- ✅ Enable/disable scheduled task mode
- ✅ Verbose logging toggle
- ✅ Processing mode selection (realtime/scheduled/both)
- ✅ Add scheduled task - Weekly batch processing option
- ✅ Build final plugin - All features integrated and working
Testing Phase - 🎉 MASSIVE SUCCESS!
- ✅ Deploy to test Emby server - PLUGIN WORKING PERFECTLY:
- ✅ PLUGIN LOADS: Successfully loads and registers with Emby
- 🚀 SCHEDULED TASK SUCCESS: Processed 15,039 episodes, updated 14,661 (97.5% success!)
- ⚡ BLAZING FAST: 1,500 episodes per second processing speed
- 🆕 MOVIES SUPPORT: Ready for movies (0 movies in test library)
- ✅ REAL-TIME + SCHEDULED: Both modes working simultaneously
- STATUS: Core functionality 100% successful - ready for production!
- Source:
plugin-release/NFOGuard.Emby.Plugin.dll(auto-copied after build) - Destination:
C:\ProgramData\Emby-Server\plugins\NFOGuard.Emby.Plugin.dll - Restart Emby Server
- Configure plugin - Dashboard → Plugins → NFOGuard → Settings
- Test with new TV episode import
- Verify database sync:
DateCreated=PremiereDate - Monitor logs for proper operation
Production Features
- Add licensing system - Custom server integration
- Performance optimization
- Error handling improvements
- Documentation and user guides
File Structure
NFOguard/
├── projectsummary.md (this file)
├── README.md
├── VERSION
├── plugin-release/ ⭐ NEW - Auto-generated
│ └── NFOGuard.Emby.Plugin.dll (ready for deployment)
├── NFOGuard.Emby.Plugin/
│ ├── Plugin.cs (main plugin class)
│ ├── PluginEntryPoint.cs (initialization)
│ ├── LibraryEventHandler.cs (core logic)
│ ├── NFOGuardScheduledTask.cs (batch processing)
│ ├── PluginConfigurationPage.cs (settings UI)
│ ├── Configuration/configPage.html (embedded UI)
│ ├── LicenseManager.cs (licensing framework)
│ ├── NFOGuard.Emby.Plugin.csproj
│ ├── build.sh / build.bat (auto-copies to plugin-release/)
│ ├── WSL_SETUP.md
│ └── DEPLOYMENT.md
├── EmbySDK/
│ ├── MediaBrowser.Common.dll
│ ├── MediaBrowser.Controller.dll
│ └── MediaBrowser.Model.dll
└── decompiled-TimeLord/ (reference only)
Current Branch Status
- Branch:
dev - Main branch:
main(for PRs) - Modified files:
README.md,VERSION - New files: Complete Emby plugin structure
Success Criteria
- Core functionality: TV episodes show import dates, not scan dates
- User experience: Seamless, automatic operation
- Reliability: Handles errors gracefully, doesn't break Emby
- Performance: Minimal impact on library operations
- Maintainability: Clean, well-documented code
Known Limitations & Future Considerations
- Movies: May need separate handling if date sync issues occur
- Bulk processing: Currently real-time only, may need batch mode
- Multi-server: Plugin needs to be installed per Emby instance
- Backup compatibility: Ensure database changes don't break backups
Key Learnings
- Emby architecture: Library events are reliable for real-time processing
- Database operations:
UpdateToRepository()is the proper way to persist changes - Plugin standards: Modern SDK-style projects work better in WSL
- TimeLord insights: Custom licensing systems are common but not required
Last Updated: 2025-01-12 Next Session: Get SDK DLLs, build plugin, add settings UI