mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-27 03:15:08 +00:00
feat(downloader): fan large segment batches across worker processes
One CPython interpreter caps sustained segment throughput at ~160 MB/s; spawned children each run the existing thread-pool path on a contiguous chunk of the batch, reaching NIC line rate on fast CDNs. Opt-in via --download-processes (default 1), engaged only for 24+ segment batches. Sessions are rebuilt per child from a picklable spec; RnetSession falls back to a single process when it has no impersonate preset.
This commit is contained in:
@@ -59,6 +59,7 @@ class DownloadContext:
|
||||
proxy: Optional[str] = None
|
||||
max_workers: Optional[int] = None
|
||||
adaptive_workers: bool = False
|
||||
download_processes: int = 1
|
||||
license_widevine: Optional[Callable] = None
|
||||
cdm: Optional[object] = None
|
||||
|
||||
@@ -234,6 +235,7 @@ class Track:
|
||||
cdm: Optional[object] = None,
|
||||
no_proxy_download: bool = False,
|
||||
adaptive_workers: bool = False,
|
||||
download_processes: int = 1,
|
||||
):
|
||||
"""Download and optionally Decrypt this Track."""
|
||||
from unshackle.core.manifests import DASH, HLS, ISM
|
||||
@@ -296,6 +298,7 @@ class Track:
|
||||
proxy=proxy,
|
||||
max_workers=max_workers,
|
||||
adaptive_workers=adaptive_workers,
|
||||
download_processes=download_processes,
|
||||
license_widevine=prepare_drm,
|
||||
cdm=cdm,
|
||||
)
|
||||
@@ -366,6 +369,7 @@ class Track:
|
||||
max_workers=max_workers,
|
||||
session=dl_session,
|
||||
adaptive=adaptive_workers,
|
||||
processes=download_processes,
|
||||
):
|
||||
file_downloaded = status_update.get("file_downloaded")
|
||||
if not file_downloaded:
|
||||
|
||||
Reference in New Issue
Block a user