aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-04-14 19:52:21 +0200
committerdec05eba <dec05eba@protonmail.com>2021-04-14 23:45:11 +0200
commitab36fbffef977b99cc03d0b77ac37bdc1b5705dc (patch)
tree17207a364eecee330a26ac117a1384ad0b4a1e97 /plugins
parent4db0876f45533d3b55ee79df2d2bc78b789b5a28 (diff)
Rework manga plugins downloading.. preparing for parallel downloads
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Manga.hpp9
-rw-r--r--plugins/Mangadex.hpp7
-rw-r--r--plugins/Manganelo.hpp8
-rw-r--r--plugins/Manganelos.hpp7
-rw-r--r--plugins/Mangatown.hpp7
5 files changed, 6 insertions, 32 deletions
diff --git a/plugins/Manga.hpp b/plugins/Manga.hpp
index 23e8dd0..60e739b 100644
--- a/plugins/Manga.hpp
+++ b/plugins/Manga.hpp
@@ -19,15 +19,11 @@ namespace QuickMedia {
const char* get_title() const override { return chapter_name.c_str(); }
PageTypez get_type() const override { return PageTypez::MANGA_IMAGES; }
- virtual ImageResult get_number_of_images(int &num_images) = 0;
- virtual ImageResult for_each_page_in_chapter(PageCallback callback) = 0;
+ virtual ImageResult get_page_image_urls(std::vector<std::string> &urls) = 0;
virtual void change_chapter(std::string new_chapter_name, std::string new_url) {
chapter_name = std::move(new_chapter_name);
- if(url != new_url) {
- url = std::move(new_url);
- chapter_image_urls.clear();
- }
+ url = std::move(new_url);
}
const std::string& get_chapter_name() const { return chapter_name; }
@@ -39,7 +35,6 @@ namespace QuickMedia {
protected:
std::string chapter_name;
std::string url;
- std::vector<std::string> chapter_image_urls;
};
class MangaChaptersPage : public TrackablePage {
diff --git a/plugins/Mangadex.hpp b/plugins/Mangadex.hpp
index 00da59c..e4a64d8 100644
--- a/plugins/Mangadex.hpp
+++ b/plugins/Mangadex.hpp
@@ -31,14 +31,9 @@ namespace QuickMedia {
class MangadexImagesPage : public MangaImagesPage {
public:
MangadexImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url) : MangaImagesPage(program, std::move(manga_name), std::move(chapter_name), std::move(url)) {}
-
- ImageResult get_number_of_images(int &num_images) override;
- ImageResult for_each_page_in_chapter(PageCallback callback) override;
-
+ ImageResult get_page_image_urls(std::vector<std::string> &urls) override;
const char* get_service_name() const override { return "mangadex"; }
private:
- // Cached
- ImageResult get_image_urls_for_chapter(const std::string &url);
bool save_mangadex_cookies(const std::string &url, const std::string &cookie_filepath);
};
} \ No newline at end of file
diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp
index e2b602f..4a7bfc3 100644
--- a/plugins/Manganelo.hpp
+++ b/plugins/Manganelo.hpp
@@ -37,13 +37,7 @@ namespace QuickMedia {
class ManganeloImagesPage : public MangaImagesPage {
public:
ManganeloImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url) : MangaImagesPage(program, std::move(manga_name), std::move(chapter_name), std::move(url)) {}
-
- ImageResult get_number_of_images(int &num_images) override;
- ImageResult for_each_page_in_chapter(PageCallback callback) override;
-
+ ImageResult get_page_image_urls(std::vector<std::string> &urls) override;
const char* get_service_name() const override { return "manganelo"; }
- private:
- // Cached
- ImageResult get_image_urls_for_chapter(const std::string &url);
};
} \ No newline at end of file
diff --git a/plugins/Manganelos.hpp b/plugins/Manganelos.hpp
index ede2712..4df0c3f 100644
--- a/plugins/Manganelos.hpp
+++ b/plugins/Manganelos.hpp
@@ -27,12 +27,7 @@ namespace QuickMedia {
class ManganelosImagesPage : public MangaImagesPage {
public:
ManganelosImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url) : MangaImagesPage(program, std::move(manga_name), std::move(chapter_name), std::move(url)) {}
-
- ImageResult get_number_of_images(int &num_images) override;
- ImageResult for_each_page_in_chapter(PageCallback callback) override;
-
+ ImageResult get_page_image_urls(std::vector<std::string> &urls) override;
const char* get_service_name() const override { return "manganelos"; }
- private:
- ImageResult get_image_urls_for_chapter(const std::string &url);
};
} \ No newline at end of file
diff --git a/plugins/Mangatown.hpp b/plugins/Mangatown.hpp
index 66d9d2a..0b6c1c4 100644
--- a/plugins/Mangatown.hpp
+++ b/plugins/Mangatown.hpp
@@ -27,12 +27,7 @@ namespace QuickMedia {
class MangatownImagesPage : public MangaImagesPage {
public:
MangatownImagesPage(Program *program, std::string manga_name, std::string chapter_name, std::string url) : MangaImagesPage(program, std::move(manga_name), std::move(chapter_name), std::move(url)) {}
-
- ImageResult get_number_of_images(int &num_images) override;
- ImageResult for_each_page_in_chapter(PageCallback callback) override;
-
+ ImageResult get_page_image_urls(std::vector<std::string> &urls) override;
const char* get_service_name() const override { return "mangatown"; }
- private:
- ImageResult get_image_urls_for_chapter(const std::string &url);
};
} \ No newline at end of file