mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Add option not to delete downloaded VODs
This commit is contained in:
parent
34b0592cf3
commit
6813bb51b4
@ -184,7 +184,7 @@ def parse_video_id(video_id):
|
|||||||
raise ConsoleError("Invalid video ID given, expected integer ID or Twitch URL")
|
raise ConsoleError("Invalid video ID given, expected integer ID or Twitch URL")
|
||||||
|
|
||||||
|
|
||||||
def download(video_id, max_workers, format='mkv', start=None, end=None, **kwargs):
|
def download(video_id, max_workers, format='mkv', start=None, end=None, keep=False, **kwargs):
|
||||||
video_id = parse_video_id(video_id)
|
video_id = parse_video_id(video_id)
|
||||||
|
|
||||||
if start and end and end <= start:
|
if start and end and end <= start:
|
||||||
@ -221,8 +221,11 @@ def download(video_id, max_workers, format='mkv', start=None, end=None, **kwargs
|
|||||||
target = _video_target_filename(video, format)
|
target = _video_target_filename(video, format)
|
||||||
_join_vods(directory, paths, target)
|
_join_vods(directory, paths, target)
|
||||||
|
|
||||||
print_out("\nDeleting vods...")
|
if keep:
|
||||||
for path in paths:
|
print_out("\nTemporary files not deleted: {}".format(directory))
|
||||||
os.unlink(path)
|
else:
|
||||||
|
print_out("\nDeleting vods...")
|
||||||
|
for path in paths:
|
||||||
|
os.unlink(path)
|
||||||
|
|
||||||
print_out("\nDownloaded: {}".format(target))
|
print_out("Downloaded: {}".format(target))
|
||||||
|
@ -89,6 +89,11 @@ COMMANDS = [
|
|||||||
"type": str,
|
"type": str,
|
||||||
"default": "mkv",
|
"default": "mkv",
|
||||||
}),
|
}),
|
||||||
|
(["-k", "--keep"], {
|
||||||
|
"help": "Don't delete downloaded VODs and playlists after merging.",
|
||||||
|
"action": "store_true",
|
||||||
|
"default": False,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user