mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Fix issue with partial downloads
When using --start or --end, only keep the segments which have been downloaded, and skip the rest.
This commit is contained in:
parent
ac37f179ef
commit
a245ffb6a4
@ -284,8 +284,14 @@ def _download_video(video_id, args):
|
|||||||
path_map = download_files(base_uri, target_dir, vod_paths, args.max_workers)
|
path_map = download_files(base_uri, target_dir, vod_paths, args.max_workers)
|
||||||
|
|
||||||
# Make a modified playlist which references downloaded VODs
|
# Make a modified playlist which references downloaded VODs
|
||||||
for segment in playlist.segments:
|
# Keep only the downloaded segments and skip the rest
|
||||||
segment.uri = path_map[segment.uri]
|
org_segments = playlist.segments.copy()
|
||||||
|
playlist.segments.clear()
|
||||||
|
for segment in org_segments:
|
||||||
|
if segment.uri in path_map:
|
||||||
|
segment.uri = path_map[segment.uri]
|
||||||
|
playlist.segments.append(segment)
|
||||||
|
|
||||||
playlist_path = target_dir + "playlist_downloaded.m3u8"
|
playlist_path = target_dir + "playlist_downloaded.m3u8"
|
||||||
playlist.dump(playlist_path)
|
playlist.dump(playlist_path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user