Files
ohm_streaming/app/AGENTS.md
root 3dc5dd8fe9
CI / Test (Python 3.11) (push) Has been cancelled
CI / Test (Python 3.12) (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Type Check (push) Has been cancelled
CI / Summary (push) Has been cancelled
feat: fix auth, provider health checks, search, and redesign UI
- Fix register/login: dict-style access on UserTable ORM objects
- Fix HTMX auth: inject JWT token in all HTMX request headers
- Fix FS7 search: use DLE AJAX endpoint /engine/ajax/search.php
- Fix ZT search: use ?p=series&search=QUERY (not DLE format)
- Fix provider health: load hardcoded providers + domain manager
- Add self.id to all anime/series providers
- Redesign homepage: Netflix-style horizontal scroll cards (.hc)
- Redesign search results: grouped by title, poster + synopsis + 3 buttons
- Add Télécharger dropdown: season download + episode picker
- Fix navbar CSS: restore .tabs flex layout, remove orphan rules
- Fix HTMX spinner: remove inline display:none, use CSS indicator
- Add AGENTS.md files across project for developer documentation
2026-03-28 00:14:31 +00:00

48 lines
2.3 KiB
Markdown

# App Core (app/)
## OVERVIEW
FastAPI application core — config, auth, download management, providers, and business logic. Routes are in `routers/`, scrapers in `downloaders/`, models in `models/`.
## STRUCTURE
```
app/
├── config.py # Pydantic Settings (loads .env)
├── database.py # SQLModel engine (created at import time)
├── download_manager.py # Async download queue (semaphore-based)
├── auth.py # JWT + bcrypt, JSON-backed UserManager
├── providers.py # ANIME_PROVIDERS, FILE_HOSTS registries
├── utils.py # sanitize_filename(), is_safe_filename()
├── watchlist.py # WatchlistManager (JSON + SQLModel hybrid)
├── episode_checker.py # New episode detection for watchlist
├── auto_download_scheduler.py # APScheduler periodic checks
├── sonarr_handler.py # Sonarr webhook processing
├── favorites.py # FavoritesManager (JSON-backed)
├── recommendation_engine.py # Download history analysis
├── recommendations.py # Latest releases fetcher
└── kitsu_api.py # Kitsu anime metadata API
```
## WHERE TO LOOK
| Need | File | Notes |
|------|------|-------|
| Add env var | `config.py` | Add to Settings class, update `.env.example` |
| Add provider domain | `providers.py` | ANIME_PROVIDERS or FILE_HOSTS dict |
| Download queue logic | `download_manager.py` | Semaphore-limited parallel downloads |
| Auth/token logic | `auth.py` | UserManager, JWT create/verify |
| Filename safety | `utils.py` | ALWAYS use sanitize_filename() |
## CONVENTIONS
**Circular import avoidance**: `episode_checker.py` uses lazy init (`set_download_manager()`) — called from `main.py:47` after both modules loaded.
**Dual storage**: Some features use JSON files (favorites, users) + SQLModel tables (watchlist, sonarr mappings). JSON is legacy, SQLModel is newer.
**Module-level side effects**: `database.py` creates engine on import. `main.py` creates `download_manager` on import (line 44). `restore_completed_downloads()` runs at module level (line 108).
## ANTI-PATTERNS
- Do NOT import `download_manager` from `main.py` in other app/ modules — causes circular imports
- Do NOT use `requests` — always `httpx.AsyncClient`
- Do NOT store secrets in `config/*.json` — use `.env`