diff options
Diffstat (limited to 'plugins/Youtube.hpp')
-rw-r--r-- | plugins/Youtube.hpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index e2dd201..1a66e5c 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -21,12 +21,13 @@ namespace QuickMedia { std::unordered_set<std::string> added_videos; }; - class YoutubeChannelPage : public Page { + class YoutubeChannelPage : public LazyFetchPage { public: - YoutubeChannelPage(Program *program, std::string url, std::string continuation_token, std::string title) : Page(program), url(std::move(url)), continuation_token(std::move(continuation_token)), title(std::move(title)) {} + YoutubeChannelPage(Program *program, std::string url, std::string continuation_token, std::string title) : LazyFetchPage(program), url(std::move(url)), continuation_token(std::move(continuation_token)), title(std::move(title)) {} const char* get_title() const override { return title.c_str(); } PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override; PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override; + PluginResult lazy_fetch(BodyItems &result_items) override; std::unordered_set<std::string> added_videos; private: @@ -38,17 +39,19 @@ namespace QuickMedia { int current_page = 0; }; - class YoutubeVideoPage : public Page { + class YoutubeRelatedVideosPage : public RelatedVideosPage { public: - YoutubeVideoPage(Program *program) : Page(program) {} + YoutubeRelatedVideosPage(Program *program) : RelatedVideosPage(program) {} + PluginResult submit(const std::string&, const std::string&, std::vector<Tab> &result_tabs) override; + }; + + class YoutubeVideoPage : public VideoPage { + public: + YoutubeVideoPage(Program *program) : VideoPage(program) {} const char* get_title() const override { return ""; } - PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override { - (void)title; - (void)url; - (void)result_tabs; - return PluginResult::ERR; - } - BodyItems get_related_media(const std::string &url) override; - PageTypez get_type() const override { return PageTypez::VIDEO; } + BodyItems get_related_media(const std::string &url, std::string &channel_url) override; + std::unique_ptr<Page> create_search_page(Program *program, int &search_delay) override; + std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program, const std::string &video_url, const std::string &video_title) override; + std::unique_ptr<LazyFetchPage> create_channels_page(Program *program, const std::string &channel_url) override; }; }
\ No newline at end of file |