|
|
@ -31,6 +31,10 @@ class HttpQuietDownloader(HttpFD):
|
|
|
|
def to_screen(self, *args, **kargs):
|
|
|
|
def to_screen(self, *args, **kargs):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)}) ...')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FragmentFD(FileDownloader):
|
|
|
|
class FragmentFD(FileDownloader):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -167,7 +171,7 @@ class FragmentFD(FileDownloader):
|
|
|
|
self.ydl,
|
|
|
|
self.ydl,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
'continuedl': True,
|
|
|
|
'continuedl': True,
|
|
|
|
'quiet': True,
|
|
|
|
'quiet': self.params.get('quiet'),
|
|
|
|
'noprogress': True,
|
|
|
|
'noprogress': True,
|
|
|
|
'ratelimit': self.params.get('ratelimit'),
|
|
|
|
'ratelimit': self.params.get('ratelimit'),
|
|
|
|
'retries': self.params.get('retries', 0),
|
|
|
|
'retries': self.params.get('retries', 0),
|
|
|
@ -237,6 +241,7 @@ class FragmentFD(FileDownloader):
|
|
|
|
start = time.time()
|
|
|
|
start = time.time()
|
|
|
|
ctx.update({
|
|
|
|
ctx.update({
|
|
|
|
'started': start,
|
|
|
|
'started': start,
|
|
|
|
|
|
|
|
'fragment_started': start,
|
|
|
|
# Amount of fragment's bytes downloaded by the time of the previous
|
|
|
|
# Amount of fragment's bytes downloaded by the time of the previous
|
|
|
|
# frag progress hook invocation
|
|
|
|
# frag progress hook invocation
|
|
|
|
'prev_frag_downloaded_bytes': 0,
|
|
|
|
'prev_frag_downloaded_bytes': 0,
|
|
|
@ -267,6 +272,9 @@ class FragmentFD(FileDownloader):
|
|
|
|
ctx['fragment_index'] = state['fragment_index']
|
|
|
|
ctx['fragment_index'] = state['fragment_index']
|
|
|
|
state['downloaded_bytes'] += frag_total_bytes - ctx['prev_frag_downloaded_bytes']
|
|
|
|
state['downloaded_bytes'] += frag_total_bytes - ctx['prev_frag_downloaded_bytes']
|
|
|
|
ctx['complete_frags_downloaded_bytes'] = state['downloaded_bytes']
|
|
|
|
ctx['complete_frags_downloaded_bytes'] = state['downloaded_bytes']
|
|
|
|
|
|
|
|
ctx['speed'] = state['speed'] = self.calc_speed(
|
|
|
|
|
|
|
|
ctx['fragment_started'], time_now, frag_total_bytes)
|
|
|
|
|
|
|
|
ctx['fragment_started'] = time.time()
|
|
|
|
ctx['prev_frag_downloaded_bytes'] = 0
|
|
|
|
ctx['prev_frag_downloaded_bytes'] = 0
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
frag_downloaded_bytes = s['downloaded_bytes']
|
|
|
|
frag_downloaded_bytes = s['downloaded_bytes']
|
|
|
@ -275,8 +283,8 @@ class FragmentFD(FileDownloader):
|
|
|
|
state['eta'] = self.calc_eta(
|
|
|
|
state['eta'] = self.calc_eta(
|
|
|
|
start, time_now, estimated_size - resume_len,
|
|
|
|
start, time_now, estimated_size - resume_len,
|
|
|
|
state['downloaded_bytes'] - resume_len)
|
|
|
|
state['downloaded_bytes'] - resume_len)
|
|
|
|
state['speed'] = s.get('speed') or ctx.get('speed')
|
|
|
|
ctx['speed'] = state['speed'] = self.calc_speed(
|
|
|
|
ctx['speed'] = state['speed']
|
|
|
|
ctx['fragment_started'], time_now, frag_downloaded_bytes)
|
|
|
|
ctx['prev_frag_downloaded_bytes'] = frag_downloaded_bytes
|
|
|
|
ctx['prev_frag_downloaded_bytes'] = frag_downloaded_bytes
|
|
|
|
self._hook_progress(state, info_dict)
|
|
|
|
self._hook_progress(state, info_dict)
|
|
|
|
|
|
|
|
|
|
|
|