From ca07c2be3bba3291f59d160eac13831c85d16550 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 3 Oct 2020 05:48:46 +0200 Subject: Remove unused code --- src/plugins/Mangatown.cpp | 57 ----------------------------------------------- 1 file changed, 57 deletions(-) (limited to 'src/plugins/Mangatown.cpp') diff --git a/src/plugins/Mangatown.cpp b/src/plugins/Mangatown.cpp index 0964310..1f3bcae 100644 --- a/src/plugins/Mangatown.cpp +++ b/src/plugins/Mangatown.cpp @@ -46,62 +46,6 @@ namespace QuickMedia { }; SuggestionResult Mangatown::update_search_suggestions(const std::string &text, BodyItems &result_items) { -#if 0 - std::string url = "https://www.mangatown.com/ajax/search/?query="; - url += url_param_encode(text); - - std::string server_response; - if(download_to_string(url, server_response, {}, use_tor, true) != DownloadResult::OK) - return SuggestionResult::NET_ERR; - - if(server_response.empty()) - return SuggestionResult::OK; - - 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[0], &server_response[server_response.size()], &json_root, &json_errors)) { - fprintf(stderr, "Mangatown suggestions json error: %s\n", json_errors.c_str()); - return SuggestionResult::ERR; - } - - if(!json_root.isObject()) - return SuggestionResult::OK; - - Json::Value &json_data = json_root["data"]; - Json::Value &json_suggestions = json_root["suggestions"]; - if(!json_data.isArray() || !json_suggestions.isArray()) - return SuggestionResult::OK; - - for(const Json::Value &child : json_suggestions) { - if(!child.isString()) { - result_items.push_back(BodyItem::create("")); - continue; - } - result_items.push_back(BodyItem::create(child.asString())); - } - - size_t index = 0; - for(const Json::Value &child : json_data) { - BodyItem *body_item = nullptr; - if(index < result_items.size()) { - body_item = result_items[index].get(); - } else { - result_items.push_back(BodyItem::create("")); - body_item = result_items.back().get(); - } - - ++index; - - if(!child.isString()) - continue; - - body_item->url = mangatown_url + child.asString(); - } - - return SuggestionResult::OK; -#else std::string url = "https://www.mangatown.com/search?name="; url += url_param_encode(text); @@ -146,7 +90,6 @@ namespace QuickMedia { cleanup: quickmedia_html_search_deinit(&html_search); return SuggestionResult::OK; -#endif } static bool is_number_with_zero_fill(const char *str) { -- cgit v1.2.3