aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/downloader/fragment.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-04-29 07:18:36 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-04-29 07:39:33 +0530
commit1d485a1a799bbeeb2faea0595676ca7d4c0f3716 (patch)
tree17e1f06c8a4e3a1fa8083c2017812988e6acc8f5 /yt_dlp/downloader/fragment.py
parent0a41f331cc3e06007b8d1abe104da196c565b505 (diff)
downloadhypervideo-pre-1d485a1a799bbeeb2faea0595676ca7d4c0f3716.tar.lz
hypervideo-pre-1d485a1a799bbeeb2faea0595676ca7d4c0f3716.tar.xz
hypervideo-pre-1d485a1a799bbeeb2faea0595676ca7d4c0f3716.zip
[cleanup] Misc fixes
Closes #3565, https://github.com/yt-dlp/yt-dlp/issues/3514#issuecomment-1105944364
Diffstat (limited to 'yt_dlp/downloader/fragment.py')
-rw-r--r--yt_dlp/downloader/fragment.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py
index 390c840bb..451e3cc2f 100644
--- a/yt_dlp/downloader/fragment.py
+++ b/yt_dlp/downloader/fragment.py
@@ -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)