mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-24 18:05:07 +00:00
feat(dl): add --proxy-download for a separate download proxy
Manifest, licence and auth stay on --proxy; track, subtitle and attachment downloads use the second proxy. Also exposed as proxy_download on the REST download job with the same server_proxy gate. The download session now ignores HTTP(S)_PROXY and copies rnet cookies set by name.
This commit is contained in:
@@ -102,6 +102,7 @@ class Attachment:
|
||||
session: Optional[AnySession] = None,
|
||||
*,
|
||||
no_proxy_download: bool = False,
|
||||
proxy_download: Optional[str] = None,
|
||||
) -> None:
|
||||
"""Download a URL-backed attachment to the temp directory."""
|
||||
if self.path is not None or not self.url or DOWNLOAD_LICENCE_ONLY.is_set():
|
||||
@@ -110,8 +111,11 @@ class Attachment:
|
||||
from unshackle.core.tracks.track import direct_session
|
||||
|
||||
session = session or self.session or requests.Session()
|
||||
if no_proxy_download and any(session.proxies.values()):
|
||||
session = direct_session(session)
|
||||
if no_proxy_download:
|
||||
if any(session.proxies.values()):
|
||||
session = direct_session(session)
|
||||
elif proxy_download:
|
||||
session = direct_session(session, proxy_download)
|
||||
|
||||
download_path = config.directories.temp / (self.file_name or "attachment")
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user