From f26534ca8d7107b14fdd5a02cbadd56505d159de Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 8 Aug 2019 22:12:09 +0200 Subject: Switch from libmpv to mpv process with window embed --- src/plugins/Manganelo.cpp | 2 +- src/plugins/Plugin.cpp | 4 +++- src/plugins/Youtube.cpp | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp index b1f02a3..e91baf0 100644 --- a/src/plugins/Manganelo.cpp +++ b/src/plugins/Manganelo.cpp @@ -67,7 +67,7 @@ namespace QuickMedia { Json::CharReaderBuilder json_builder; std::unique_ptr json_reader(json_builder.newCharReader()); std::string json_errors; - if(json_reader->parse(&server_response.front(), &server_response.back(), &json_root, &json_errors)) { + if(!json_reader->parse(&server_response[0], &server_response[server_response.size()], &json_root, &json_errors)) { fprintf(stderr, "Manganelo suggestions json error: %s\n", json_errors.c_str()); return SuggestionResult::ERR; } diff --git a/src/plugins/Plugin.cpp b/src/plugins/Plugin.cpp index 86f5d7d..5d81aad 100644 --- a/src/plugins/Plugin.cpp +++ b/src/plugins/Plugin.cpp @@ -28,11 +28,13 @@ namespace QuickMedia { } DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector &additional_args) { - std::vector args = { "curl", "-H", "Accept-Language: en-US,en;q=0.5", "--compressed", "-s", "-L", url.c_str() }; + std::vector args = { "curl", "-H", "Accept-Language: en-US,en;q=0.5", "--compressed", "-s", "-L" }; for(const CommandArg &arg : additional_args) { args.push_back(arg.option.c_str()); args.push_back(arg.value.c_str()); } + args.push_back("--"); + args.push_back(url.c_str()); args.push_back(nullptr); if(exec_program(args.data(), accumulate_string, &result) != 0) return DownloadResult::NET_ERR; diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index a5670ec..2a3f011 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -48,13 +48,12 @@ namespace QuickMedia { if(json_end == 0 || json_start >= json_end) return SuggestionResult::ERR; - --json_end; Json::Value json_root; Json::CharReaderBuilder json_builder; std::unique_ptr json_reader(json_builder.newCharReader()); std::string json_errors; - if(json_reader->parse(&server_response[json_start], &server_response[json_end], &json_root, &json_errors)) { + if(!json_reader->parse(&server_response[json_start], &server_response[json_end], &json_root, &json_errors)) { fprintf(stderr, "Youtube suggestions json error: %s\n", json_errors.c_str()); return SuggestionResult::ERR; } -- cgit v1.2.3