From 5ccd94a771cf1031b837c7bc4d0baeab4b810a38 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 2 Jun 2020 18:36:36 +0200 Subject: 4chan: Use cached boards.json instead of downloading it everytime --- src/plugins/Fourchan.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/plugins/Fourchan.cpp') diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp index 06728fe..073356b 100644 --- a/src/plugins/Fourchan.cpp +++ b/src/plugins/Fourchan.cpp @@ -1,7 +1,8 @@ #include "../../plugins/Fourchan.hpp" +#include "../../include/DataView.hpp" +#include "../../include/Storage.hpp" #include #include -#include "../../include/DataView.hpp" #include #include @@ -45,10 +46,17 @@ namespace QuickMedia { } PluginResult Fourchan::get_front_page(BodyItems &result_items) { +#if 0 std::string server_response; if(download_to_string(fourchan_url + "boards.json", server_response, {}, use_tor) != DownloadResult::OK) return PluginResult::NET_ERR; - +#else + std::string server_response; + if(file_get_content("../../../boards.json", server_response) != 0) { + fprintf(stderr, "failed to read boards.json\n"); + return PluginResult::ERR; + } +#endif Json::Value json_root; Json::CharReaderBuilder json_builder; std::unique_ptr json_reader(json_builder.newCharReader()); -- cgit v1.2.3