Commit Graph

87 Commits

Author SHA1 Message Date
Maximilian Dorninger
f5253990e0 switch from APScheduler to Taskiq (#461)
This PR replaces the APScheduler lib with the Taskiq task queuing lib. 

# why

APScheduler doesn't support FastAPI's DI in tasks, this makes them quite
cumbersome to read and write since DB, Repositories and Services all
need to be instanciated manually.

Moreover, Taskiq makes it easier to start background tasks from FastAPI
requests. This enables MM to move to a more event-based architecture.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* App now uses an orchestrated async startup/shutdown and runs
background scheduling via a database-backed task queue; startup enqueues
pre-load/import/update tasks.

* **Bug Fixes**
* Improved torrent client handling with clearer conflict messages and
guidance for manual resolution.
* Enhanced logging around season, episode and metadata update
operations; minor regex/behaviour formatting preserved.

* **Chores**
* Updated dependencies to support the new task queue and connection
pooling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-26 21:23:24 +01:00
Maximilian Dorninger
c45c9e5873 add correlation id to logging (#398)
This PR adds Correlation IDs to logs and request responses.

```
2026-02-04 12:40:32,793 - [afd825081d874d6e835b5c59a6ddb371] DEBUG - media_manager.movies - get_importable_movies(): Found 5 importable movies.
2026-02-04 12:40:32,794 - [afd825081d874d6e835b5c59a6ddb371] INFO - uvicorn.access - send(): 172.19.0.1:64094 - "GET /api/v1/movies/importable HTTP/1.1" 200
2026-02-04 12:40:47,322 - [41d30b7003fd45288c6a4bb1cfba5e7a] INFO - uvicorn.access - send(): 127.0.0.1:52964 - "GET /api/v1/health HTTP/1.1" 200
2026-02-04 12:41:17,408 - [157027ea5dde472a9e620f53739ccd53] INFO - uvicorn.access - send(): 127.0.0.1:39850 - "GET /api/v1/health HTTP/1.1" 200
```
2026-02-04 13:55:05 +01:00
Maximilian Dorninger
a39e0d204a Ruff enable type annotations rule (#362)
This PR enables the ruff rule for return type annotations (ANN), and
adds the ty package for type checking.
2026-01-06 17:07:19 +01:00
maxid
d5c41430a6 add back hello word message 2026-01-05 23:05:46 +01:00
Marcel Hellwig
29476e2008 ruff: enable INT and N lint
this renames some files to use snake_case and add Error suffix to custom
exceptions
2026-01-05 19:30:42 +01:00
Marcel Hellwig
55b2dd63d8 ruff: add ARG linter
this mostly either removes unused parameters, prefixes them with an
underscore or uses the @override decorator to tell the linter, that that
method comes from a superclass and can't be changed
2026-01-05 19:30:42 +01:00
Marcel Hellwig
ff013ac76e ruff: enable I lint 2026-01-05 19:30:42 +01:00
maxid
f144ce1bdf format files after merge 2026-01-02 16:25:41 +01:00
maxid
2d2afaba50 Merge branch 'master' into fork/strangeglyph/master
# Conflicts:
#	media_manager/main.py
2026-01-02 16:24:18 +01:00
maxid
a253ffd946 only accept TRUE 2026-01-02 16:21:58 +01:00
strangeglyph
64f01cc919 Allow frontend files to be followed through symlinks 2026-01-02 12:33:15 +01:00
maxid
02480f1420 fix: add ConflictError exception handler 2026-01-01 21:05:20 +01:00
maxid
a695a5e3ee fix: update image endpoint 2026-01-01 14:01:14 +01:00
maxid
40130c6a37 refactor: rename AllEncompassingConfig to MediaManagerConfig 2025-12-29 23:38:17 +01:00
maxid
90c2a1d65b refactor: split up main.py into multiple files 2025-12-29 23:37:22 +01:00
maxid
63a65c85bd add log level env variable 2025-12-29 11:57:00 +01:00
maxid
8b8559a50f format main.py 2025-12-28 23:41:52 +01:00
maxid
8c380da3b4 refactor logging configuration: use constant for log level 2025-12-28 23:39:14 +01:00
maxDorninger
e8563b25e2 extend .gitignore; update logfile config and add env var to configure the location of the log file; add accompanying docs 2025-11-02 20:31:12 +01:00
maxDorninger
b89320f25d prevent circular imports 2025-11-02 14:19:01 +01:00
Maximilian Dorninger
bc59eac490 remove log related to the removed init_db call in media_manager/main.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-02 13:41:17 +01:00
maxDorninger
a5c55cc591 remove database initialization function which conflicts with alembic 2025-11-02 13:22:07 +01:00
Tyler Satre
106190d7ac Improve local dev experience 2025-10-31 12:19:23 -04:00
maxDorninger
6f4423e501 disable useless logs 2025-10-30 16:17:49 +01:00
maxDorninger
b6ff4e917f fix oauth being enabled regardless of the config 2025-09-18 12:01:48 +02:00
Maximilian Dorninger
3a553d32e6 Remove unneeded methods from allowed CORS methods
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-13 21:06:00 +02:00
maxDorninger
8f5cc9329c update how oauth is handled 2025-09-13 18:42:34 +02:00
maxDorninger
6203ec5ce0 format files 2025-09-12 20:09:44 +02:00
maxDorninger
786b14527c update cors middleware 2025-09-04 21:36:52 +02:00
maxDorninger
1f544e55e8 add support for multiple oauth providers 2025-09-04 20:05:45 +02:00
maxDorninger
1fca7b083a fix duplicate apscheduler jobs and add postgres to docker image 2025-07-23 00:02:23 +02:00
maxDorninger
b9dfb07cf7 make API return HTTP Conflict 409 on Unique Violation/Integrity Error in DB 2025-07-22 22:49:49 +02:00
maxDorninger
a2982e12c0 remove outdated comment 2025-07-22 17:54:44 +02:00
maxDorninger
6a273da054 fix http always being used as protocol for the callback url when using oauth 2025-07-22 16:53:13 +02:00
maxDorninger
f38c825105 add auto_download_movie_requests to scheduler 2025-07-19 17:13:01 +02:00
maxDorninger
f1a01b4d43 automatically create all directories 2025-07-18 14:33:12 +02:00
maxDorninger
0df004df6f fix and move create default user function to auth.users 2025-07-18 13:45:51 +02:00
Backslash
56d5faaec5 Route redirects
Redirect routes to /web for front end.

Co-authored-by: Maximilian Dorninger <97409287+maxdorninger@users.noreply.github.com>
2025-07-18 21:01:04 +10:00
wjbeckett
a4d31d9ac9 fix: linting. 2025-07-18 16:32:33 +10:00
wjbeckett
4177409b59 feat: Add default admin user creation and root route redirects
- Auto-create admin user on first startup (admin@example.com/admin)
- Add redirects from /, /dashboard, /login to /web/ for better UX
- Enhanced startup logging with login credentials
- Improved config documentation for admin_emails

Fixes initial setup UX issues with web UI access and authentication.
2025-07-18 16:04:01 +10:00
wjbeckett
df7d00ad99 feat: improve container setup and fix deployment issues
- Move images directory from /data/images to /app/images to separate app data from user media
- Implement config folder approach instead of direct file mounting
- Add automatic config initialization with example config on first boot
- Remove hardcoded media directory environment variables from Dockerfile
- Update startup script to handle config folder setup and validation
- Only create application-managed directories, not user media directories
- Update docker-compose.yaml to use config folder volume mapping

Fixes container startup failures when config.toml doesn't exist and improves
separation between application data and user media directories.
2025-07-18 12:54:08 +10:00
maxDorninger
d5f09736f8 format files 2025-07-17 21:09:48 +02:00
maxDorninger
fe525a9397 fix HTTP error 404 exception handler 2025-07-17 21:07:36 +02:00
maxDorninger
cb73c9e14f fix images not working 2025-07-17 20:46:03 +02:00
maxDorninger
a232d5e935 format files 2025-07-17 17:20:49 +02:00
maxDorninger
c2b7440bdd adjust config options of backend 2025-07-17 16:38:25 +02:00
maxDorninger
81c8381a90 adjust backend to serve static frontend files 2025-07-17 16:04:57 +02:00
maxDorninger
c186df94b8 add error handling to automatic imports of torrents and add proper db session handling to scheduled tasks 2025-07-16 12:03:46 +02:00
maxDorninger
9db9c85fc6 make all var names lower case and fix circular imports 2025-07-11 00:47:29 +02:00
maxDorninger
7ce6de7f85 replace all the other config usages with allencompassing config 2025-07-10 22:25:05 +02:00