mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-04 00:55:15 +00:00
[cleanup] Misc fixes
Closes #3565, https://github.com/yt-dlp/yt-dlp/issues/3514#issuecomment-1105944364
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import concurrent.futures
|
||||
import contextlib
|
||||
import http.client
|
||||
import json
|
||||
@ -5,12 +6,6 @@ import math
|
||||
import os
|
||||
import time
|
||||
|
||||
try:
|
||||
import concurrent.futures
|
||||
can_threaded_download = True
|
||||
except ImportError:
|
||||
can_threaded_download = False
|
||||
|
||||
from .common import FileDownloader
|
||||
from .http import HttpFD
|
||||
from ..aes import aes_cbc_decrypt_bytes, unpad_pkcs7
|
||||
@ -28,6 +23,8 @@ class HttpQuietDownloader(HttpFD):
|
||||
def to_screen(self, *args, **kargs):
|
||||
pass
|
||||
|
||||
console_title = to_screen
|
||||
|
||||
def report_retry(self, err, count, retries):
|
||||
super().to_screen(
|
||||
f'[download] Got server HTTP error: {err}. Retrying (attempt {count} of {self.format_retries(retries)}) ...')
|
||||
@ -501,8 +498,7 @@ class FragmentFD(FileDownloader):
|
||||
|
||||
max_workers = math.ceil(
|
||||
self.params.get('concurrent_fragment_downloads', 1) / ctx.get('max_progress', 1))
|
||||
if can_threaded_download and max_workers > 1:
|
||||
|
||||
if max_workers > 1:
|
||||
def _download_fragment(fragment):
|
||||
ctx_copy = ctx.copy()
|
||||
download_fragment(fragment, ctx_copy)
|
||||
|
Reference in New Issue
Block a user