diff options
Diffstat (limited to 'src/plugins/Manganelo.cpp')
-rw-r--r-- | src/plugins/Manganelo.cpp | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp index 8ce9e01..b67acb2 100644 --- a/src/plugins/Manganelo.cpp +++ b/src/plugins/Manganelo.cpp @@ -226,36 +226,7 @@ namespace QuickMedia { return PluginResult::OK; } - ImageResult ManganeloImagesPage::get_number_of_images(int &num_images) { - num_images = 0; - ImageResult image_result = get_image_urls_for_chapter(url); - if(image_result != ImageResult::OK) - return image_result; - - num_images = chapter_image_urls.size(); - return ImageResult::OK; - } - - ImageResult ManganeloImagesPage::for_each_page_in_chapter(PageCallback callback) { - std::vector<std::string> image_urls; - ImageResult image_result = get_image_urls_for_chapter(url); - if(image_result != ImageResult::OK) - return image_result; - - image_urls = chapter_image_urls; - - for(const std::string &url : image_urls) { - if(!callback(url)) - break; - } - - return ImageResult::OK; - } - - ImageResult ManganeloImagesPage::get_image_urls_for_chapter(const std::string &url) { - if(!chapter_image_urls.empty()) - return ImageResult::OK; - + ImageResult ManganeloImagesPage::get_page_image_urls(std::vector<std::string> &urls) { std::string website_data; if(download_to_string(url, website_data, {}, true) != DownloadResult::OK) return ImageResult::NET_ERR; @@ -273,16 +244,16 @@ namespace QuickMedia { std::string image_url = strip(src); urls->push_back(std::move(image_url)); } - }, &chapter_image_urls); + }, &urls); cleanup: quickmedia_html_search_deinit(&html_search); - if(result != 0) { - chapter_image_urls.clear(); + if(result != 0) return ImageResult::ERR; - } - if(chapter_image_urls.empty()) + + if(urls.empty()) return ImageResult::ERR; + return ImageResult::OK; } }
\ No newline at end of file |