|
|
@ -77,7 +77,10 @@ class FragmentFD(FileDownloader):
|
|
|
|
assert 'ytdl_corrupt' not in ctx
|
|
|
|
assert 'ytdl_corrupt' not in ctx
|
|
|
|
stream, _ = sanitize_open(self.ytdl_filename(ctx['filename']), 'r')
|
|
|
|
stream, _ = sanitize_open(self.ytdl_filename(ctx['filename']), 'r')
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
ctx['fragment_index'] = json.loads(stream.read())['downloader']['current_fragment']['index']
|
|
|
|
ytdl_data = json.loads(stream.read())
|
|
|
|
|
|
|
|
ctx['fragment_index'] = ytdl_data['downloader']['current_fragment']['index']
|
|
|
|
|
|
|
|
if 'extra_state' in ytdl_data['downloader']:
|
|
|
|
|
|
|
|
ctx['extra_state'] = ytdl_data['downloader']['extra_state']
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
ctx['ytdl_corrupt'] = True
|
|
|
|
ctx['ytdl_corrupt'] = True
|
|
|
|
finally:
|
|
|
|
finally:
|
|
|
@ -90,6 +93,8 @@ class FragmentFD(FileDownloader):
|
|
|
|
'index': ctx['fragment_index'],
|
|
|
|
'index': ctx['fragment_index'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if 'extra_state' in ctx:
|
|
|
|
|
|
|
|
downloader['extra_state'] = ctx['extra_state']
|
|
|
|
if ctx.get('fragment_count') is not None:
|
|
|
|
if ctx.get('fragment_count') is not None:
|
|
|
|
downloader['fragment_count'] = ctx['fragment_count']
|
|
|
|
downloader['fragment_count'] = ctx['fragment_count']
|
|
|
|
frag_index_stream.write(json.dumps({'downloader': downloader}))
|
|
|
|
frag_index_stream.write(json.dumps({'downloader': downloader}))
|
|
|
|