feat: implement NFO ID storage and media scan tracking

Task 3 (NFO data):
- Add parse_nfo_ids() method to NFOService
- Extract TMDB/TVDB IDs from NFO files during scan
- Update database with extracted IDs
- Add comprehensive unit and integration tests

Task 4 (Media scan):
- Track initial media scan with SystemSettings flag
- Run background loading only on first startup
- Skip media scan on subsequent runs
This commit is contained in:
2026-01-21 19:36:54 +01:00
parent 050db40af3
commit 125892abe5
6 changed files with 572 additions and 43 deletions

View File

@@ -124,22 +124,32 @@ make sure you maintain the function on one location
1. ✅ scanning anime from folder - COMPLETED
Implemented initial scan tracking using SystemSettings table. Anime folder scanning now only runs during initial setup, not on each application start.
- Added SystemSettings model with initial_scan_completed flag
- Created SystemSettingsService for managing setup state
- Modified fastapi_app.py to check scan completion status on startup
- Added unit test for SystemSettingsService
- Added SystemSettings model with initial_scan_completed flag
- Created SystemSettingsService for managing setup state
- Modified fastapi_app.py to check scan completion status on startup
- Added unit test for SystemSettingsService
2. ✅ Nfo scan - COMPLETED
Implemented initial NFO scan tracking using SystemSettings table. NFO scanning now only runs during initial setup, not on each application start.
- Added NFO scanning to startup process in fastapi_app.py
- Check initial_nfo_scan_completed flag before running NFO scan
- Run NFO scan only on first startup if TMDB API key is configured and NFO features enabled
- Mark NFO scan as completed after successful first run
- Skip NFO scan on subsequent startups
- Added NFO scanning to startup process in fastapi_app.py
- Check initial_nfo_scan_completed flag before running NFO scan
- Run NFO scan only on first startup if TMDB API key is configured and NFO features enabled
- Mark NFO scan as completed after successful first run
- Skip NFO scan on subsequent startups
3. nfo data
during nfo scan read tmdb id from nfo file and write it in db.
during nfo scan read tvdb id from nfo file and write it in db.
3. nfo data - COMPLETED
Implemented NFO ID extraction and database storage during NFO scan. TMDB and TVDB IDs are now read from existing NFO files and stored in the database.
- Added parse_nfo_ids() method to NFOService to extract IDs from NFO XML
- Modified process_nfo_for_series() to parse IDs and update database
- Modified scan_and_process_nfo() to pass database session for updates
- IDs are extracted from <uniqueid> elements or dedicated <tmdbid>/<tvdbid> elements
- Created comprehensive unit tests for NFO ID parsing (10 tests)
- Created integration tests for database storage
4. Media scan
make sure media scan runs only on setup and not on each start
4. Media scan - COMPLETED
Implemented initial media scan tracking using SystemSettings table. Media scanning (background loading of episode metadata) now only runs during initial setup, not on each application start.
- Check initial_media_scan_completed flag before running media scan
- Run media scan (checking for incomplete series) only on first startup
- Mark media scan as completed after successful first run
- Skip media scan on subsequent startups
- Existing SystemSettingsService methods already supported this flag