diff --git a/CHANGELOG.md b/CHANGELOG.md index 520e2c0..7955bcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Twitch Downloader change log * Added `source` as alias for best available quality (#33) * Added `--no-join` option to `download` to skip ffmpeg join (#36) +* Added `--overwrite` option to `download` to overwrite target without prompting + for confirmation (#37) 1.11.0 (2020-09-03) ------------------- diff --git a/twitchdl/commands.py b/twitchdl/commands.py index 0173501..f51f1b1 100644 --- a/twitchdl/commands.py +++ b/twitchdl/commands.py @@ -106,7 +106,7 @@ def _select_playlist_interactive(playlists): return uri -def _join_vods(playlist_path, target): +def _join_vods(playlist_path, target, overwrite, no_overwrite): command = [ "ffmpeg", "-i", playlist_path, @@ -116,6 +116,9 @@ def _join_vods(playlist_path, target): "-loglevel", "warning", ] + if overwrite: + command.append("-y") + print_out("{}".format(" ".join(command))) result = subprocess.run(command) if result.returncode != 0: @@ -308,7 +311,7 @@ def _download_video(video_id, args): print_out("\n\nJoining files...") target = _video_target_filename(video, args.format) - _join_vods(playlist_path, target) + _join_vods(playlist_path, target, args.overwrite) if args.keep: print_out("\nTemporary files not deleted: {}".format(target_dir)) diff --git a/twitchdl/console.py b/twitchdl/console.py index b291356..439d484 100644 --- a/twitchdl/console.py +++ b/twitchdl/console.py @@ -123,6 +123,11 @@ COMMANDS = [ "action": "store_true", "default": False, }), + (["--overwrite"], { + "help": "Overwrite the target file if it already exists without prompting.", + "action": "store_true", + "default": False, + }) ], ), ]