split download and ffmpeg procces

This commit is contained in:
root
2026-09-27 12:52:05 +08:00
parent 993fd8f217
commit b6160430a0
13 changed files with 868 additions and 341 deletions
+8 -2
View File
@@ -33,6 +33,7 @@ def test_http_api_validates_and_snapshots_settings(tmp_path: Path) -> None:
service = DownloadService(config)
assert service.bootstrap()["settings"]["proxy"] == DEFAULT_PROXY
assert service.bootstrap()["settings"]["max_active_downloads"] == 1
assert service.bootstrap()["settings"]["max_active_ffmpeg"] == 1
server = DownloadHTTPServer(config, service)
thread = threading.Thread(target=server.serve_forever, daemon=True)
thread.start()
@@ -52,12 +53,15 @@ def test_http_api_validates_and_snapshots_settings(tmp_path: Path) -> None:
"default_directory": str(config.download_root),
"proxy": "http://127.0.0.1:7890",
"max_active_downloads": 2,
"max_active_ffmpeg": 3,
},
method="PUT",
)
assert settings[0] == 200
assert settings[1]["max_active_downloads"] == 2
assert settings[1]["max_active_ffmpeg"] == 3
assert service.store.max_active_downloads() == 2
assert service.store.max_active_ffmpeg() == 3
task = _request(base, "/api/tasks", {"title": "batch", "directory": str(config.download_root), "payload": json.dumps([_item("http://127.0.0.1")])})
assert task[0] == 201
assert task[1]["proxy"] == "http://127.0.0.1:7890"
@@ -236,9 +240,11 @@ def test_cover_download_keeps_original_url_without_img2_size_path(tmp_path: Path
def test_cli_uses_max_active_downloads() -> None:
args = build_argument_parser().parse_args(["--max-active-downloads", "3"])
args = build_argument_parser().parse_args(["--max-active-downloads", "3", "--max-active-ffmpeg", "4"])
assert config_from_args(args).max_active_downloads == 3
config = config_from_args(args)
assert config.max_active_downloads == 3
assert config.max_active_ffmpeg == 4
def _get(base: str, path: str) -> tuple[int, dict[str, object]]: