fix: Anime list endpoint now returns data correctly

- Root cause: Server needed restart to complete initialization
- Startup process syncs data files to DB and loads into memory
- Verified: GET /api/anime returns 192 anime with full metadata
This commit is contained in:
2026-01-21 18:58:24 +01:00
parent f9e4970615
commit b2379e05cf
6 changed files with 21 additions and 676 deletions

View File

@@ -119,14 +119,23 @@ For each task completed:
## TODO List:
All issues resolved!
**FIXED:** Anime list endpoint now correctly returns anime data after server startup.
### Recently Completed:
**Root Cause:** The anime list was empty because:
1. The `SeriesApp.list` was initialized with `skip_load=True` to avoid loading from filesystem during initialization
2. Series data is synced from filesystem data files to the database during server startup
3. Series are then loaded from the database into `SeriesApp` memory via `anime_service._load_series_from_db()`
4. The server needed to be restarted to complete this initialization process
- ✅ Fixed async generator exception handling in `get_optional_database_session`
- ✅ Fixed NFO service year extraction from series names (e.g., "Series Name (2023)")
- ✅ Added logic to skip NFO creation if NFO already exists
- ✅ Added database update when existing NFOs are found
- ✅ Added comprehensive unit tests for all fixes
**Solution:** The existing startup process in [fastapi_app.py](../src/server/fastapi_app.py) correctly:
- Syncs series from data files to database via `sync_series_from_data_files()`
- Loads series from database into memory via `anime_service._load_series_from_db()`
---
The issue was resolved by restarting the server to allow the full initialization process to complete.
**Verified:** GET `/api/anime` now returns 192 anime series with complete metadata including:
- Unique key (primary identifier)
- Name and folder
- Missing episodes tracking
- NFO metadata status
- TMDB/TVDB IDs when available