diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index ebd6ac4..7770f1e 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3862,6 +3862,7 @@ namespace QuickMedia { std::vector<CommandArg> extra_args; const bool is_manganelo = (strcmp(images_page->get_service_name(), "manganelo") == 0); + const bool is_mangakatana = (strcmp(images_page->get_service_name(), "mangakatana") == 0); const char *website_url = images_page->get_website_url(); if(is_manganelo) { extra_args = { @@ -3892,9 +3893,25 @@ namespace QuickMedia { } } else { int64_t file_size = 0; - if(download_to_file(url, image_filepath_tmp.data, extra_args, true) != DownloadResult::OK || (is_manganelo && file_get_size(image_filepath_tmp, &file_size) == 0 && file_size < 255)) { + bool download_success = download_to_file(url, image_filepath_tmp.data, extra_args, true) == DownloadResult::OK; + if(!download_success) { + remove(image_filepath_tmp.data.c_str()); if(!image_download_cancel) show_notification("QuickMedia", "Failed to download image: " + url, Urgency::CRITICAL); return true; + } else if(is_manganelo && file_get_size(image_filepath_tmp, &file_size) == 0 && file_size < 255) { + remove(image_filepath_tmp.data.c_str()); + if(!image_download_cancel) show_notification("QuickMedia", "Failed to download image: " + url, Urgency::CRITICAL); + return true; + } else if(is_mangakatana && file_get_size(image_filepath_tmp, &file_size) == 0 && file_size < 255) { + remove(image_filepath_tmp.data.c_str()); + std::string new_url = url; + string_replace_all(new_url, "://i3", "://i2"); + + download_success = download_to_file(new_url, image_filepath_tmp.data, extra_args, true) == DownloadResult::OK; + if(!download_success) { + if(!image_download_cancel) show_notification("QuickMedia", "Failed to download image: " + url, Urgency::CRITICAL); + return true; + } } } |