Implement initial scan tracking for one-time setup
- Add SystemSettings model to track setup completion status - Create SystemSettingsService for managing setup flags - Modify fastapi_app startup to check and set initial_scan_completed flag - Anime folder scanning now only runs on first startup - Update DATABASE.md with new system_settings table documentation - Add unit test for SystemSettingsService functionality This ensures expensive one-time operations like scanning the entire anime directory only occur during initial setup, not on every application restart.
This commit is contained in:
@@ -119,23 +119,18 @@ For each task completed:
|
||||
|
||||
## TODO List:
|
||||
|
||||
✅ **FIXED:** Anime list endpoint now correctly returns anime data after server startup.
|
||||
Make sure you do not produce doublicate code. the function below is mostly implemented.
|
||||
make sure you maintain the function on one location
|
||||
|
||||
**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
|
||||
1. scanning anime from folder
|
||||
make sure that scanning anime from folder only runs on setup and not on each start
|
||||
|
||||
**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()`
|
||||
2. Nfo scan
|
||||
make sure nfo scan runs only on setup and not on each start
|
||||
|
||||
The issue was resolved by restarting the server to allow the full initialization process to complete.
|
||||
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.
|
||||
|
||||
**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
|
||||
4. Media scan
|
||||
make sure media scan runs only on setup and not on each start
|
||||
|
||||
Reference in New Issue
Block a user