aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-12 22:37:23 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-12 22:37:23 +0100
commit5c27b5fbaa0f1693bf4605a3e6fc57d0f066c0ec (patch)
tree5a9d3e2cccc08d671da99c45fee040f3e24fae3c /plugins
parent09d8b9895c7001f991d2aab7a75e8b573edb086f (diff)
Allow plugins to add their own tabs in ctrl+r instead of search, comments, related and channel
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ImageBoard.hpp4
-rw-r--r--plugins/Lbry.hpp4
-rw-r--r--plugins/Matrix.hpp6
-rw-r--r--plugins/MediaGeneric.hpp6
-rw-r--r--plugins/Page.hpp13
-rw-r--r--plugins/Peertube.hpp4
-rw-r--r--plugins/Soundcloud.hpp2
-rw-r--r--plugins/Youtube.hpp5
8 files changed, 9 insertions, 35 deletions
diff --git a/plugins/ImageBoard.hpp b/plugins/ImageBoard.hpp
index 7914ef1..e7c4c5d 100644
--- a/plugins/ImageBoard.hpp
+++ b/plugins/ImageBoard.hpp
@@ -32,10 +32,6 @@ namespace QuickMedia {
void copy_to_clipboard(const BodyItem *body_item) const override;
bool autoplay_next_item() override { return true; }
- std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program) override;
- std::unique_ptr<Page> create_channels_page(Program*, const std::string&) override {
- return nullptr;
- }
virtual PluginResult login(const std::string &token, const std::string &pin, std::string &response_msg);
// If |filepath| is empty then no file is uploaded
virtual PostResult post_comment(const std::string &captcha_id, const std::string &captcha_solution, const std::string &comment, const std::string &filepath = "") = 0;
diff --git a/plugins/Lbry.hpp b/plugins/Lbry.hpp
index ac7c4b4..1cddf56 100644
--- a/plugins/Lbry.hpp
+++ b/plugins/Lbry.hpp
@@ -38,10 +38,6 @@ namespace QuickMedia {
LbryVideoPage(Program *program, std::string title, std::string url) : VideoPage(program, std::move(url)), title(std::move(title)) {}
const char* get_title() const override { return ""; }
//BodyItems get_related_media(const std::string &url) override;
- //bool create_search_page(Program *program, Tab &tab) override;
- std::unique_ptr<Page> create_comments_page(Program *program) override;
- std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program) override;
- std::unique_ptr<Page> create_channels_page(Program *program, const std::string &channel_url) override;
std::string get_download_url(int max_height) override;
std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override;
std::string get_audio_url(std::string &ext) override;
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index cd7bdce..680b8b6 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -416,12 +416,6 @@ namespace QuickMedia {
public:
MatrixVideoPage(Program *program) : VideoPage(program, "") {}
const char* get_title() const override { return ""; }
- std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program*) override {
- return nullptr;
- }
- std::unique_ptr<Page> create_channels_page(Program*, const std::string&) override {
- return nullptr;
- }
};
class MatrixChatPage : public Page {
diff --git a/plugins/MediaGeneric.hpp b/plugins/MediaGeneric.hpp
index ca111a4..61f1ad9 100644
--- a/plugins/MediaGeneric.hpp
+++ b/plugins/MediaGeneric.hpp
@@ -84,11 +84,7 @@ namespace QuickMedia {
MediaGenericVideoPage(Program *program, MediaGenericSearchPage *search_page, const std::string &url) : VideoPage(program, url), search_page(search_page) {}
const char* get_title() const override { return ""; }
BodyItems get_related_media(const std::string &url) override;
- bool create_search_page(Program *program, Tab &tab) override;
- std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program) override;
- std::unique_ptr<Page> create_channels_page(Program*, const std::string&) override {
- return nullptr;
- }
+ PluginResult get_related_pages(const BodyItems &related_videos, const std::string &channel_url, std::vector<Tab> &result_tabs) override;
private:
MediaGenericSearchPage *search_page;
};
diff --git a/plugins/Page.hpp b/plugins/Page.hpp
index 4fed1c8..c07679d 100644
--- a/plugins/Page.hpp
+++ b/plugins/Page.hpp
@@ -129,12 +129,13 @@ namespace QuickMedia {
virtual PageTypez get_type() const override { return PageTypez::VIDEO; }
virtual bool autoplay_next_item() { return false; }
virtual BodyItems get_related_media(const std::string &url) { (void)url; return {}; }
- virtual bool create_search_page(Program *program, Tab &tab) { (void)program; (void)tab; return false; }
- virtual std::unique_ptr<Page> create_comments_page(Program *program) { (void)program; return nullptr; }
- // Return nullptr if the service doesn't support related videos page
- virtual std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program) = 0;
- // Return nullptr if the service doesn't support channels page
- virtual std::unique_ptr<Page> create_channels_page(Program *program, const std::string &channel_url) = 0;
+ virtual PluginResult get_related_pages(const BodyItems &related_videos, const std::string &channel_url, std::vector<Tab> &result_tabs) {
+ (void)related_videos;
+ (void)channel_url;
+ (void)result_tabs;
+ return PluginResult::OK;
+ }
+ virtual int get_related_pages_first_tab() { return 0; }
virtual void set_url(std::string new_url) { url = std::move(new_url); }
std::string get_url() { return url; }
virtual std::string get_download_url(int max_height) { (void)max_height; return url; }
diff --git a/plugins/Peertube.hpp b/plugins/Peertube.hpp
index c8578f7..90453ee 100644
--- a/plugins/Peertube.hpp
+++ b/plugins/Peertube.hpp
@@ -78,10 +78,6 @@ namespace QuickMedia {
PeertubeVideoPage(Program *program, std::string server, std::string url, bool autoplay_next) : VideoPage(program, std::move(url)), server(server), autoplay_next(autoplay_next) {}
const char* get_title() const override { return ""; }
//BodyItems get_related_media(const std::string &url) override;
- //bool create_search_page(Program *program, Tab &tab) override;
- std::unique_ptr<Page> create_comments_page(Program *program) override;
- std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program) override;
- std::unique_ptr<Page> create_channels_page(Program *program, const std::string &channel_url) override;
std::string get_download_url(int max_height) override;
std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override;
std::string get_audio_url(std::string &ext) override;
diff --git a/plugins/Soundcloud.hpp b/plugins/Soundcloud.hpp
index fa41e88..eeb1f46 100644
--- a/plugins/Soundcloud.hpp
+++ b/plugins/Soundcloud.hpp
@@ -61,8 +61,6 @@ namespace QuickMedia {
SoundcloudAudioPage(Program *program, const std::string &url) : VideoPage(program, url) {}
const char* get_title() const override { return ""; }
bool autoplay_next_item() override { return true; }
- std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *) override { return nullptr; }
- std::unique_ptr<Page> create_channels_page(Program *, const std::string &) override { return nullptr; }
std::string url_get_playable_url(const std::string &url) override;
bool video_should_be_skipped(const std::string &url) override { return url == "track" || url.find("/stream/users/") != std::string::npos; }
};
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index 97dea19..23f7e20 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -143,10 +143,7 @@ namespace QuickMedia {
YoutubeVideoPage(Program *program, std::string url);
const char* get_title() const override { return ""; }
BodyItems get_related_media(const std::string &url) override;
- bool create_search_page(Program *program, Tab &tab) override;
- std::unique_ptr<Page> create_comments_page(Program *program) override;
- std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program) override;
- std::unique_ptr<Page> create_channels_page(Program *program, const std::string &channel_url) override;
+ PluginResult get_related_pages(const BodyItems &related_videos, const std::string &channel_url, std::vector<Tab> &result_tabs) override;
void set_url(std::string new_url) override;
std::string get_url_timestamp() override { return timestamp; }
std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override;