aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-06-19 14:10:44 +0200
committerdec05eba <dec05eba@protonmail.com>2021-06-19 14:10:44 +0200
commitca875b39ac35ac1499c303672f7217e2a7bbcab1 (patch)
treea12e6568173aecab3ff79b9804c980f86934054b /src/QuickMedia.cpp
parent5ec1811fa7499386f324f13a3a49dbe7d8ea6741 (diff)
Fix youtube audio download downloading video when not needed
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index c02b9ab..9613199 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -6453,8 +6453,15 @@ namespace QuickMedia {
bool start() override {
remove(output_filepath.c_str());
- std::vector<const char*> args = { "youtube-dl", "-f", "bestvideo+bestaudio/best", "--no-warnings", "--no-continue", "--output", output_filepath.c_str(), "--newline" };
- if(no_video) args.push_back("-x");
+ std::vector<const char*> args = { "youtube-dl", "--no-warnings", "--no-continue", "--output", output_filepath.c_str(), "--newline" };
+ if(no_video) {
+ args.push_back("-f");
+ args.push_back("bestaudio/best");
+ args.push_back("-x");
+ } else {
+ args.push_back("-f");
+ args.push_back("bestvideo+bestaudio/best");
+ }
args.insert(args.end(), { "--", url.c_str(), nullptr });
if(exec_program_pipe(args.data(), &read_program) != 0)
@@ -6580,8 +6587,15 @@ namespace QuickMedia {
if(download_use_youtube_dl) {
task_result = run_task_with_loading_screen([this, url, &filename]{
std::string json_str;
- std::vector<const char*> args = { "youtube-dl", "-f", "bestvideo+bestaudio/best", "--skip-download", "--print-json", "--no-warnings" };
- if(no_video) args.push_back("-x");
+ std::vector<const char*> args = { "youtube-dl", "--skip-download", "--print-json", "--no-warnings" };
+ if(no_video) {
+ args.push_back("-f");
+ args.push_back("bestaudio/best");
+ args.push_back("-x");
+ } else {
+ args.push_back("-f");
+ args.push_back("bestvideo+bestaudio/best");
+ }
args.insert(args.end(), { "--", url, nullptr });
if(exec_program(args.data(), accumulate_string, &json_str) != 0)
return false;