From b894f0b2283a4fcd42fc41f9517b16d623ae3adb Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 5 Aug 2019 21:07:11 +0200 Subject: Add thumbnails for manganelo --- src/Plugin.cpp | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/Plugin.cpp (limited to 'src/Plugin.cpp') diff --git a/src/Plugin.cpp b/src/Plugin.cpp deleted file mode 100644 index c31e715..0000000 --- a/src/Plugin.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "../plugins/Plugin.hpp" -#include "../include/Program.h" -#include -#include - -static int accumulate_string(char *data, int size, void *userdata) { - std::string *str = (std::string*)userdata; - str->append(data, size); - return 0; -} - -namespace QuickMedia { - SuggestionResult Plugin::update_search_suggestions(const std::string &text, std::vector> &result_items) { - (void)text; - (void)result_items; - return SuggestionResult::OK; - } - - std::vector> Plugin::get_related_media(const std::string &url) { - (void)url; - return {}; - } - - DownloadResult Plugin::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() }; - for(const CommandArg &arg : additional_args) { - args.push_back(arg.option.c_str()); - args.push_back(arg.value.c_str()); - } - args.push_back(nullptr); - if(exec_program(args.data(), accumulate_string, &result) != 0) - return DownloadResult::NET_ERR; - return DownloadResult::OK; - } - - std::string Plugin::url_param_encode(const std::string ¶m) const { - std::ostringstream result; - result.fill('0'); - result << std::hex; - - for(char c : param) { - if(isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') { - result << c; - } else { - result << std::uppercase; - result << "%" << std::setw(2) << (int)(unsigned char)(c); - } - } - - return result.str(); - } -} \ No newline at end of file -- cgit v1.2.3