Verify NFO/artwork loading isolation for anime add

- Confirmed BackgroundLoaderService loads NFO only for specific anime
- NFOService.create_tvshow_nfo() called with task-specific parameters
- No global scanning occurs during anime add operations
- Added verification test (test_anime_add_nfo_isolation.py)
- Updated instructions.md to mark task as completed
This commit is contained in:
2026-01-23 15:00:36 +01:00
parent 48a2fd0f2a
commit 5e233bcba0
2 changed files with 324 additions and 31 deletions

View File

@@ -119,37 +119,22 @@ For each task completed:
## TODO List:
Make sure you do not produce doublicate code. the function below is mostly implemented.
make sure you maintain the function on one location
### Completed Tasks:
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
1.**Verify NFO/Artwork Loading Isolation** (Completed: 2026-01-23)
- **Task**: Ensure during anime add, NFO, logo, art, etc. is loaded only for the specific anime being added.
- **Status**: VERIFIED - Implementation is correct
- **Details**:
- The `BackgroundLoaderService._load_nfo_and_images()` method only processes the specific anime in the loading task
- NFOService.create_tvshow_nfo() is called with parameters specific to the single anime (name, folder, year)
- No global scanning or bulk NFO loading occurs during anime add
- SerieList.load_series() only checks for existing files, does not download/create new ones
- **Files Reviewed**:
- src/server/services/background_loader_service.py (lines 454-544)
- src/server/api/anime.py (lines 694-920)
- src/core/entities/SerieList.py (lines 149-250)
- **Test Created**: tests/integration/test_anime_add_nfo_isolation.py (verification test)
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
### Active Tasks:
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 - 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
(No active tasks - awaiting new requirements)