aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/LocalManga.hpp6
-rw-r--r--src/plugins/LocalManga.cpp12
2 files changed, 10 insertions, 8 deletions
diff --git a/plugins/LocalManga.hpp b/plugins/LocalManga.hpp
index 27ee89d..d112892 100644
--- a/plugins/LocalManga.hpp
+++ b/plugins/LocalManga.hpp
@@ -46,8 +46,8 @@ namespace QuickMedia {
class LocalMangaImagesPage : public MangaImagesPage {
public:
- LocalMangaImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url, std::string thumbnail_url, std::vector<LocalMangaPage> pages) :
- MangaImagesPage(program, std::move(manga_name), std::move(chapter_name), std::move(url), std::move(thumbnail_url)), pages(std::move(pages)) {}
+ LocalMangaImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url, std::string thumbnail_url) :
+ MangaImagesPage(program, std::move(manga_name), std::move(chapter_name), std::move(url), std::move(thumbnail_url)) {}
ImageResult get_number_of_images(int &num_images) override;
ImageResult for_each_page_in_chapter(PageCallback callback) override;
const char* get_service_name() const override { return "local-manga"; }
@@ -55,7 +55,5 @@ namespace QuickMedia {
bool is_local() override { return true; }
private:
ImageResult get_image_urls_for_chapter(const std::string &url);
- private:
- std::vector<LocalMangaPage> pages;
};
} \ No newline at end of file
diff --git a/src/plugins/LocalManga.cpp b/src/plugins/LocalManga.cpp
index 3ad4ffa..c39752b 100644
--- a/src/plugins/LocalManga.cpp
+++ b/src/plugins/LocalManga.cpp
@@ -208,9 +208,7 @@ namespace QuickMedia {
return PluginResult::OK;
}
- Path chapter_url = Path(get_config().local_manga_directory).join(content_url).join(args.url);
- std::vector<LocalMangaPage> pages = get_images_in_manga(chapter_url);
- result_tabs.push_back(Tab{nullptr, std::make_unique<LocalMangaImagesPage>(program, content_title, args.title, args.url, thumbnail_url, std::move(pages)), nullptr});
+ result_tabs.push_back(Tab{nullptr, std::make_unique<LocalMangaImagesPage>(program, content_title, args.title, args.url, thumbnail_url), nullptr});
if(is_program_executable_by_name("automedia"))
append_seen_manga_to_automedia_seen(content_url + "/" + args.url);
@@ -241,13 +239,19 @@ namespace QuickMedia {
return ImageResult::OK;
}
- ImageResult LocalMangaImagesPage::get_image_urls_for_chapter(const std::string&) {
+ ImageResult LocalMangaImagesPage::get_image_urls_for_chapter(const std::string &url) {
if(!chapter_image_urls.empty())
return ImageResult::OK;
+ Path chapter_url = Path(get_config().local_manga_directory).join(manga_name).join(url);
+ std::vector<LocalMangaPage> pages = get_images_in_manga(chapter_url);
+ if(pages.empty())
+ return ImageResult::ERR;
+
for(const LocalMangaPage &local_manga_page : pages) {
chapter_image_urls.push_back(local_manga_page.path.data);
}
+
return ImageResult::OK;
}
} \ No newline at end of file