mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Ask overwrite confirmation early
Ask whether to overwrite before starting download, this way once download starts, there will be no more prompts.
This commit is contained in:
parent
8156b18b37
commit
4fd532f05d
@ -224,6 +224,12 @@ def _download_clip(slug, args):
|
|||||||
target = _clip_target_filename(clip, args)
|
target = _clip_target_filename(clip, args)
|
||||||
print_out("Target: <blue>{}</blue>".format(target))
|
print_out("Target: <blue>{}</blue>".format(target))
|
||||||
|
|
||||||
|
if not args.overwrite and path.exists(target):
|
||||||
|
response = input("File exists. Overwrite? [Y/n]: ")
|
||||||
|
if response.lower().strip() not in ["", "y"]:
|
||||||
|
raise ConsoleError("Aborted")
|
||||||
|
args.overwrite = True
|
||||||
|
|
||||||
url = get_clip_authenticated_url(slug, args.quality)
|
url = get_clip_authenticated_url(slug, args.quality)
|
||||||
print_out("<dim>Selected URL: {}</dim>".format(url))
|
print_out("<dim>Selected URL: {}</dim>".format(url))
|
||||||
|
|
||||||
@ -249,6 +255,12 @@ def _download_video(video_id, args):
|
|||||||
target = _video_target_filename(video, args)
|
target = _video_target_filename(video, args)
|
||||||
print_out("Output: <blue>{}</blue>".format(target))
|
print_out("Output: <blue>{}</blue>".format(target))
|
||||||
|
|
||||||
|
if not args.overwrite and path.exists(target):
|
||||||
|
response = input("File exists. Overwrite? [Y/n]: ")
|
||||||
|
if response.lower().strip() not in ["", "y"]:
|
||||||
|
raise ConsoleError("Aborted")
|
||||||
|
args.overwrite = True
|
||||||
|
|
||||||
print_out("<dim>Fetching access token...</dim>")
|
print_out("<dim>Fetching access token...</dim>")
|
||||||
access_token = twitch.get_access_token(video_id)
|
access_token = twitch.get_access_token(video_id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user