Add option not to delete downloaded VODs

This commit is contained in:
Ivan Habunek 2019-08-23 10:16:49 +02:00
parent 34b0592cf3
commit 6813bb51b4
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95
2 changed files with 13 additions and 5 deletions

View File

@ -184,7 +184,7 @@ def parse_video_id(video_id):
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)
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)
_join_vods(directory, paths, target)
if keep:
print_out("\nTemporary files not deleted: {}".format(directory))
else:
print_out("\nDeleting vods...")
for path in paths:
os.unlink(path)
print_out("\nDownloaded: {}".format(target))
print_out("Downloaded: {}".format(target))

View File

@ -89,6 +89,11 @@ COMMANDS = [
"type": str,
"default": "mkv",
}),
(["-k", "--keep"], {
"help": "Don't delete downloaded VODs and playlists after merging.",
"action": "store_true",
"default": False,
}),
],
),
]