aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
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;