107 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
7824891557 Fix qbittorrent category error (#456)
This PR fixes an error caused by MM trying to set the category save path
to None if the string is empty.
2026-02-22 19:51:10 +01:00
natarelli22
d8a0ec66c3 Support for handling Single Episode Torrents (#331)
**Description**
As explained on #322, MediaManager currently only matches torrents that
represent full seasons or season packs.
As a result, valid episode-based releases — commonly returned by
indexers such as EZTV — are filtered out during scoring and never
considered for download.

Initial changes to the season parsing logic allow these torrents to be
discovered.
However, additional changes are required beyond season parsing to
properly support single-episode imports.

This PR is intended as a work-in-progress / RFC to discuss the required
changes and align on the correct approach before completing the
implementation.

**Things planned to do**
[X] Update Web UI to better display episode-level details
[ ] Update TV show import logic to handle single episode files, instead
of assuming full season files (to avoid integrity errors when episodes
are missing)
[ ] Create episode file tables to store episode-level data, similar to
season files
[ ] Implement fetching and downloading logic for single-episode torrents

**Notes / current limitations**
At the moment, the database and import logic assume one file per season
per quality, which works for season packs but not for episode-based
releases.

These changes are intentionally not completed yet and are part of the
discussion this PR aims to start.

**Request for feedback**
This represents a significant change in how TV content is handled in
MediaManager.
Before proceeding further, feedback from @maxdorninger on the overall
direction and next steps would be greatly appreciated.

Once aligned, the remaining tasks can be implemented incrementally.

---------

Co-authored-by: Maximilian Dorninger <97409287+maxdorninger@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-22 15:21:19 +01:00
Maximilian Dorninger
2665106847 Merge pull request #401 from maxdorninger/fix-env-variables
Fix download clients config being read from env variables
2026-02-08 16:37:15 +01:00
maxid
abac894a95 fix download clients config being read from env variables without the mediamanager prefix 2026-02-04 22:49:24 +01:00
maxid
12854ff661 format files 2026-02-04 21:34:37 +01:00
Sergey Khruschak
24fcba6bee Torrent file name sanitizing (#390)
Hi, I've added file names sanitization when saving the torrent file, as
previously the import was failing on torrents with special characters in
names. This fixes #367
2026-02-03 17:09:36 +01:00
Marcel Hellwig
96b84d45db Adding some more new lints (#393)
Enable `UP` and `TRY` lint
2026-02-01 18:04:15 +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
Marcel Hellwig
75406cbc64 ruff: add RET lint
lints about assign and immediatly returning a variable
2026-01-05 19:30:42 +01:00
Marcel Hellwig
805a6981a6 ruff: enable PTH lint 2026-01-05 19:30:42 +01:00
Marcel Hellwig
acd883df21 ruff: enable PIE lint
this just removes needless pass or ...
2026-01-05 19:30:42 +01:00
Marcel Hellwig
f2141ca8b8 ruff: enable PERF lint
this complains a lot about using manual append where a list
comprehension would be more suitable
2026-01-05 19:30:42 +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
5368cad77a ruff: add S linter
this mostly adds a timeout=60 to all requests

this does mainly wants a timeout to all requests functions, since when
left out they hang infinitly.
I added a timeout of 60s, which is probably way too high, but since
before this there was none, I guess it's an improvement?
2026-01-05 19:30:42 +01:00
Marcel Hellwig
1857cf501c ruff: enable RUF lint 2026-01-05 19:30:42 +01:00
Marcel Hellwig
ff013ac76e ruff: enable I lint 2026-01-05 19:30:42 +01:00
Marcel Hellwig
eac58d2843 ruff: enable FAST lint
this mostly is replacing the response_model attribute with a return type
of that function since that's the more idiomatic way to do
2026-01-05 19:30:42 +01:00
Marcel Hellwig
97cb3b5c1e ruff: enable EM lint 2026-01-05 19:30:42 +01:00
Marcel Hellwig
2c36adfd75 ruff: Enable B lint 2026-01-05 19:30:42 +01:00
maxid
e14f19bd45 format files 2025-12-30 00:19:28 +01:00
maxid
40130c6a37 refactor: rename AllEncompassingConfig to MediaManagerConfig 2025-12-29 23:38:17 +01:00
maxid
9e6851d055 remove unnecessary logs in the torrents module 2025-12-29 11:43:35 +01:00
Maximilian Dorninger
2b21915b1f Fix torrent deletion logic 2025-12-21 15:25:42 +01:00
maxid
e0a04bb040 fix: filter out non-directory items from import suggestions 2025-12-20 21:01:55 +01:00
Maximilian Dorninger
b854a13338 Update media_manager/torrent/utils.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-20 20:59:28 +01:00
Maximilian Dorninger
5c8cff00a9 Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-20 20:58:06 +01:00
maxid
12fe84017c fix bug: hidden directories included in import suggestions 2025-12-20 20:31:31 +01:00
maxid
ed78bde604 reduce logs 2025-12-20 20:22:35 +01:00
maxid
cfe34358a0 refactor title processing to remove special characters and brackets 2025-12-20 20:00:27 +01:00
maxid
1f50b18b9f refactor media detection functions to improve accuracy 2025-12-20 19:37:34 +01:00
Maximilian Dorninger
4bb3064779 Merge pull request #294 from maxdorninger/fix-deleted-torrents-leaving-stray-season-files
Fix deleted torrents leaving stray season files
2025-12-20 14:29:47 +01:00
maxid
c78bc05627 format files 2025-12-20 13:08:32 +01:00
maxid
bfd9196f5e add support for handling invalid URL schemas and following redirects for torrent downloads 2025-12-20 13:08:05 +01:00
maxid
bcd1ccfd21 enhance torrent deletion to remove associated media files if the torrent was not imported 2025-12-19 18:42:38 +01:00
Maximilian Dorninger
c17efaa306 Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-07 22:50:07 +01:00
maxid
d2e8d5eeb7 make movies be importable 2025-12-07 19:56:54 +01:00
maxid
1f7dd795d1 remove year at the end of directory name in order to improve search results 2025-12-07 18:04:01 +01:00
maxid
fdaaf099cb add ability to import existing media 2025-12-07 15:29:03 +01:00
Maximilian Dorninger
7c7c1b90ea Merge pull request #173 from maxdorninger/multithread-indexer-module
Speedup torrent searching and disable useless logs
2025-10-30 19:00:35 +01:00
maxDorninger
724d358107 deactivate transmission logs 2025-10-30 17:47:58 +01:00
Maximilian Dorninger
855385b097 Apply suggestion from @Copilot
raise exception rather than return it and fix var name switch up

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-30 16:25:44 +01:00
maxDorninger
22c4ddc869 add ability to change imported state of a torrent 2025-10-29 17:29:46 +01:00
maxDorninger
39c88a0519 add retry and delete buttons to torrents table 2025-10-29 14:22:22 +01:00
Ross
d34ac0e0b5 handle NotImplementedError for backwards compatibility 2025-08-29 20:36:22 +02:00
Ross
4f6829ae9c handle hardlink_to UnsupportedOperation exception the same as OSError + type fixes 2025-08-29 20:32:24 +02:00
Maximilian Dorninger
89f4a76825 Fix regex for importing episodes (#128)
This pull request makes a small but significant change to the
`import_torrent_files` method in `media_manager/movies/service.py`. The
change updates the regular expression used to match subtitle file names,
making it more flexible in recognizing language codes.

*
[`media_manager/movies/service.py`](diffhunk://#diff-57cfa309860beba31573487107eba3f7ef8ef60429c48c02fb262b9f4ff9b8d3L527-R527):
Updated the regular expression in `import_torrent_files` to match
language codes in subtitle file names that are separated by either a dot
(`.`) or a space (` `), instead of only a dot.

It fixes #124.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-01 15:21:55 +02:00
Maximilian Dorninger
35de9629ec Update media_manager/torrent/utils.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-31 22:48:15 +02:00
maxDorninger
a095e1987f add function remove_special_characters and use it in the import torrent files functions, it removes characters that break SMB or jellyfin 2025-07-31 22:42:31 +02:00
Maximilian Dorninger
4a3dea3cab Update media_manager/torrent/download_clients/qbittorrent.py
initialize answer instead of marking it with global

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-27 15:03:02 +02:00