From 47a057cc5a7b26d150bfa9b081bf081542280344 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 17 Aug 2022 18:35:42 +0200 Subject: Mangakatana: try different image mirror if download fails --- TODO | 3 ++- src/QuickMedia.cpp | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index a9f5574..9500678 100644 --- a/TODO +++ b/TODO @@ -227,4 +227,5 @@ Body image cache (async image loader) should take requested size into considerat To make quickmedia more resilient against broken youtube videos, quickmedia should try other quality if video/audio fails to play. Also do that if the download is stuck/slow for the current quality. Make youtube work with age restricted copy righted videos, such as https://www.youtube.com/watch?v=7n3dP_1KqBw. Age restricted videos also play slowly because they have url part that needs to be decoded. Upload media once in 4chan, on comment enter and then re-use that after solving captcha; instead of reuploading video after each captcha retry. If possible... -Support migration from one manga service to another, automatically by selecting the manga to migrate from which service (or select all). Also do that in automedia. Give error if it's not possible to do automatically and show option to manually select the matching manga/chapter. Quickmedia should also be able to automatically migrate automedia in the same process or a separate option. \ No newline at end of file +Support migration from one manga service to another, automatically by selecting the manga to migrate from which service (or select all). Also do that in automedia. Give error if it's not possible to do automatically and show option to manually select the matching manga/chapter. Quickmedia should also be able to automatically migrate automedia in the same process or a separate option. +Instead of having an option to disable rounded corners, add an option to set corner radius where radius=0 means disabling the shader. \ No newline at end of file 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 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; + } } } -- cgit v1.2.3