|
|
@ -4,6 +4,7 @@ import functools
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import random
|
|
|
|
import random
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
|
|
|
|
import threading
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
from ..minicurses import (
|
|
|
|
from ..minicurses import (
|
|
|
@ -63,6 +64,7 @@ class FileDownloader:
|
|
|
|
min_filesize: Skip files smaller than this size
|
|
|
|
min_filesize: Skip files smaller than this size
|
|
|
|
max_filesize: Skip files larger than this size
|
|
|
|
max_filesize: Skip files larger than this size
|
|
|
|
xattr_set_filesize: Set ytdl.filesize user xattribute with expected size.
|
|
|
|
xattr_set_filesize: Set ytdl.filesize user xattribute with expected size.
|
|
|
|
|
|
|
|
progress_delta: The minimum time between progress output, in seconds
|
|
|
|
external_downloader_args: A dictionary of downloader keys (in lower case)
|
|
|
|
external_downloader_args: A dictionary of downloader keys (in lower case)
|
|
|
|
and a list of additional command-line arguments for the
|
|
|
|
and a list of additional command-line arguments for the
|
|
|
|
executable. Use 'default' as the name for arguments to be
|
|
|
|
executable. Use 'default' as the name for arguments to be
|
|
|
@ -88,6 +90,9 @@ class FileDownloader:
|
|
|
|
self.params = params
|
|
|
|
self.params = params
|
|
|
|
self._prepare_multiline_status()
|
|
|
|
self._prepare_multiline_status()
|
|
|
|
self.add_progress_hook(self.report_progress)
|
|
|
|
self.add_progress_hook(self.report_progress)
|
|
|
|
|
|
|
|
if self.params.get('progress_delta'):
|
|
|
|
|
|
|
|
self._progress_delta_lock = threading.Lock()
|
|
|
|
|
|
|
|
self._progress_delta_time = time.monotonic()
|
|
|
|
|
|
|
|
|
|
|
|
def _set_ydl(self, ydl):
|
|
|
|
def _set_ydl(self, ydl):
|
|
|
|
self.ydl = ydl
|
|
|
|
self.ydl = ydl
|
|
|
@ -366,6 +371,12 @@ class FileDownloader:
|
|
|
|
if s['status'] != 'downloading':
|
|
|
|
if s['status'] != 'downloading':
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if update_delta := self.params.get('progress_delta'):
|
|
|
|
|
|
|
|
with self._progress_delta_lock:
|
|
|
|
|
|
|
|
if time.monotonic() < self._progress_delta_time:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
self._progress_delta_time += update_delta
|
|
|
|
|
|
|
|
|
|
|
|
s.update({
|
|
|
|
s.update({
|
|
|
|
'_eta_str': self.format_eta(s.get('eta')).strip(),
|
|
|
|
'_eta_str': self.format_eta(s.get('eta')).strip(),
|
|
|
|
'_speed_str': self.format_speed(s.get('speed')),
|
|
|
|
'_speed_str': self.format_speed(s.get('speed')),
|
|
|
|