Replaces the read-only 'NFO Diagnostics' page with a full per-anime
Settings page reached from the right-click context menu on series cards.
Users can now view and edit key, name, folder, tmdb_id, tvdb_id and site
for each anime; changes are persisted to the DB and optionally written
back to the NFO file or used to regenerate it.
Backend
- Rename NfoDiagnosticsResponse -> NfoSettingsResponse,
NfoSeriesDiagnostics -> NfoSeriesSettings
- Rename get_nfo_diagnostics -> get_nfo_settings,
repair_nfo -> repair_nfo_settings
- Fix nfo.py bug: repair was calling non-existent
update_series_nfo_status(); now uses update_nfo_status() and an
explicit AnimeSeriesService.update(nfo_path=...)
- New endpoints on /api/anime/{key}:
GET /settings -> AnimeSettingsResponse
PUT /settings -> AnimeSettingsResponse
(body: name/folder/tmdb_id/tvdb_id/site,
options: apply_to_nfo, rename_disk)
POST /regenerate-nfo -> AnimeSettingsRegenerateNfoResponse
- New Pydantic models: AnimeSettingsResponse,
AnimeSettingsUpdateRequest, AnimeSettingsRegenerateNfoResponse
- /anime/settings page route; /settings/nfo now 301-redirects to it
Frontend
- New AniWorld.AnimeSettingsManager JS module (single-page form,
no tabs) with public API init/loadSeries/saveSettings/regenerateNfo/
validateField/populateForm/showSaveSuccess/showError
- New anime-settings.html template + anime-settings.css
- Right-click menu: data-action 'nfo-diagnostics' replaced by
'anime-settings' (label 'Anime Settings'), navigates to
/anime/settings?key=...
- Library 'Open NFO Diagnostics' link renamed to 'Open Anime Settings'
Bug fix
- context-menu click handler was calling hide() BEFORE building the
navigation URL, which cleared currentSeriesKey to null and produced
/anime/settings?key=null. Captures the key into a local const first.
Regression-locked by tests/frontend/unit/context_menu.test.js.
Tests
- 21 new pytest tests in tests/api/test_anime_settings_endpoints.py
(GET/PUT/regenerate-nfo, auth, validation, nfo-repair bug regression)
- tests/api/test_nfo_endpoints.py trimmed to 6 focused tests
- 31 new Vitest unit tests for AnimeSettingsManager
- 5 new Vitest unit tests for ContextMenu (incl. source-invariant
regression guard for the hide()-before-key bug)
- 5 new Playwright E2E tests covering right-click, direct nav,
legacy /settings/nfo redirect, and context-menu labels
- New vitest.config.js (environment: happy-dom)
Docs
- Docs/API.md: new section 'Anime Settings Endpoints'
- Docs/CHANGELOG.md: documents the rename and the context-menu bug fix
Verified
- pytest: 27/27 (21 new + 6 trimmed nfo)
- vitest: 36/36 (31 anime-settings + 5 context-menu)
- playwright e2e: 5/5
Aniworld Download Manager
A web-based anime download manager with REST API, WebSocket real-time updates, and a modern web interface.
Features
- Web interface for managing anime library
- REST API for programmatic access
- WebSocket real-time progress updates
- Download queue with priority management
- Automatic library scanning for missing episodes
- NFO metadata management with TMDB integration
- Automatic poster/fanart/logo downloads
- JWT-based authentication
- SQLite database for persistence
- Comprehensive test coverage (1,070+ tests, 91.3% coverage)
Quick Start
Prerequisites
- Python 3.10+
- Conda (recommended) or virtualenv
Installation
- Clone the repository:
git clone https://github.com/your-repo/aniworld.git
cd aniworld
- Create and activate conda environment:
conda create -n AniWorld python=3.10
conda activate AniWorld
- Install dependencies:
pip install -r requirements.txt
- Start the server:
python -m uvicorn src.server.fastapi_app:app --host 127.0.0.1 --port 8000
- Open http://127.0.0.1:8000 in your browser
First-Time Setup
- Navigate to http://127.0.0.1:8000/setup
- Set a master password (minimum 8 characters, mixed case, number, special character)
- Configure your anime directory path
- (Optional) Configure NFO settings with your TMDB API key
- Login with your master password
NFO Metadata Setup (Optional)
For automatic NFO file generation with metadata and images:
- Get a free TMDB API key from https://www.themoviedb.org/settings/api
- Go to Configuration → NFO Settings in the web interface
- Enter your TMDB API key and click "Test Connection"
- Enable auto-creation and select which images to download
- NFO files will be created automatically during downloads
Documentation
| Document | Description |
|---|---|
| docs/API.md | REST API and WebSocket reference |
| docs/ARCHITECTURE.md | System architecture and design |
| docs/CONFIGURATION.md | Configuration options |
| docs/DATABASE.md | Database schema |
| docs/DEVELOPMENT.md | Developer setup guide |
| docs/TESTING.md | Testing guidelines |
Project Structure
src/
+-- cli/ # CLI interface (legacy)
+-- config/ # Application settings
+-- core/ # Domain logic
| +-- SeriesApp.py # Main application facade
| +-- SerieScanner.py # Directory scanning
| +-- entities/ # Domain entities
| +-- providers/ # External provider adapters
+-- server/ # FastAPI web server
+-- api/ # REST API endpoints
+-- services/ # Business logic
+-- models/ # Pydantic models
+-- database/ # SQLAlchemy ORM
+-- middleware/ # Auth, rate limiting
API Endpoints
| Endpoint | Description |
|---|---|
POST /api/auth/login |
Authenticate and get JWT token |
GET /api/anime |
List anime with missing episodes |
GET /api/anime/search?query= |
Search for anime |
POST /api/queue/add |
Add episodes to download queue |
POST /api/queue/start |
Start queue processing |
GET /api/queue/status |
Get queue status |
GET /api/nfo/check |
Check NFO status for anime |
POST /api/nfo/create |
Create NFO files |
WS /ws/connect |
WebSocket for real-time updates |
See docs/API.md for complete API reference.
Configuration
Environment variables (via .env file):
| Variable | Default | Description |
|---|---|---|
JWT_SECRET_KEY |
(random) | Secret for JWT signing |
DATABASE_URL |
sqlite:///./data/aniworld.db |
Database connection |
ANIME_DIRECTORY |
(empty) | Path to anime library |
TMDB_API_KEY |
(empty) | TMDB API key for metadata |
LOG_LEVEL |
INFO |
Logging level |
See docs/CONFIGURATION.md for all options.
Running Tests
The project includes a comprehensive test suite with 1,070+ tests and 91.3% coverage across all critical systems:
# Run all Python tests
conda run -n AniWorld python -m pytest tests/ -v
# Run unit tests only
conda run -n AniWorld python -m pytest tests/unit/ -v
# Run integration tests
conda run -n AniWorld python -m pytest tests/integration/ -v
# Run with coverage report
conda run -n AniWorld python -m pytest tests/ --cov --cov-report=html
# Run JavaScript/E2E tests (requires Node.js)
npm test # Unit tests (Vitest)
npm run test:e2e # E2E tests (Playwright)
Test Coverage:
- ✅ 1,070+ tests across 4 priority tiers (644 Python tests passing, 426 JavaScript/E2E tests)
- ✅ 91.3% code coverage
- ✅ TIER 1 Critical: 159/159 tests - Scheduler, NFO batch, download queue, persistence
- ✅ TIER 2 High Priority: 390/390 tests - Frontend UI, WebSocket, dark mode, settings
- ✅ TIER 3 Medium Priority: 95/156 tests - Performance, edge cases (core scenarios complete)
- ✅ TIER 4 Polish: 426 tests - Internationalization, accessibility, media server compatibility
- ✅ Security: Complete coverage (authentication, authorization, CSRF, XSS, SQL injection)
- ✅ Performance: Validated (200+ concurrent WebSocket clients, batch operations)
See docs/TESTING_COMPLETE.md for comprehensive testing documentation.
Technology Stack
- Web Framework: FastAPI 0.104.1
- Database: SQLite + SQLAlchemy 2.0
- Auth: JWT (python-jose) + passlib
- Validation: Pydantic 2.5
- Logging: structlog
- Testing: pytest + pytest-asyncio
Application Lifecycle
Initialization
On first startup, the application performs a one-time sync of series from data files to the database:
- FastAPI lifespan starts
- Database is initialized
sync_series_from_data_files()reads all data files from the anime directory (creates temporary SeriesApp)- Series metadata is synced to the database
- DownloadService initializes (triggers main
SeriesAppcreation) SeriesApploads series from database via service layer (not from files)
On subsequent startups, the same flow applies but the sync finds no new series. SeriesApp always initializes with an empty series list (skip_load=True) and loads data from the database on demand, avoiding redundant file system scans.
Adding New Series
When adding a new series:
- Series is added to the database via
AnimeService - Data file is created in the anime directory
- In-memory
SerieListis updated viaload_series_from_list()
License
MIT License