Skip to content

Commit 018676d

Browse files
committed
Disable progress when --quiet is passed.
When the `--quiet` flag is passed, disable the progress bar for the download. This is also important because if `--quiet` is passed and the output is being redirected to something other than stdout, then it will end up raising an error (error directly from `downloader-cli`). Disabling progress bar altogether is the expected behaviour and it stops underlying errors as well. Fixes #209
1 parent d2b93ef commit 018676d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ytmdl/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def download(link, yt_title, args) -> str:
114114
defaults.DEFAULT.SONG_QUALITY,
115115
Style.RESET_ALL
116116
))
117-
path = yt.dw(link, args.proxy, yt_title, args.format)
117+
path = yt.dw(link, args.proxy, yt_title,
118+
args.format, no_progress=args.quiet)
118119

119120
if type(path) is not str:
120121
# Probably an error occured

ytmdl/yt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ def dw_using_yt(link, proxy, song_name, datatype, no_progress=False):
9595
}
9696

9797
if not no_progress:
98+
logger.debug("Enabling progress hook.")
99+
logger.debug(f"Passed value for no_progress: {no_progress}")
98100
ydl_opts['progress_hooks'] = [progress_handler]
99101

100102
if proxy is not None:

0 commit comments

Comments
 (0)