aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ImageBoard.hpp2
-rw-r--r--plugins/Matrix.hpp2
-rw-r--r--plugins/Page.hpp2
-rw-r--r--plugins/Pornhub.hpp5
-rw-r--r--plugins/Soundcloud.hpp56
-rw-r--r--plugins/Spotify.hpp5
-rw-r--r--plugins/Youtube.hpp4
7 files changed, 73 insertions, 3 deletions
diff --git a/plugins/ImageBoard.hpp b/plugins/ImageBoard.hpp
index c65b269..bd47bec 100644
--- a/plugins/ImageBoard.hpp
+++ b/plugins/ImageBoard.hpp
@@ -21,6 +21,7 @@ namespace QuickMedia {
std::unique_ptr<LazyFetchPage> create_channels_page(Program*, const std::string&) override {
return nullptr;
}
+ std::string get_url() override { return video_url; }
virtual PluginResult login(const std::string &token, const std::string &pin, std::string &response_msg);
virtual PostResult post_comment(const std::string &captcha_id, const std::string &comment) = 0;
virtual const std::string& get_pass_id();
@@ -28,5 +29,6 @@ namespace QuickMedia {
const std::string board_id;
const std::string thread_id;
const std::vector<std::string> cached_media_urls;
+ std::string video_url;
};
} \ No newline at end of file
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 7028e4d..26ad926 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -420,6 +420,8 @@ namespace QuickMedia {
std::unique_ptr<LazyFetchPage> create_channels_page(Program*, const std::string&) override {
return nullptr;
}
+ std::string get_url() override { return url; }
+ std::string url;
};
class MatrixChatPage : public Page {
diff --git a/plugins/Page.hpp b/plugins/Page.hpp
index 44526db..f1ef893 100644
--- a/plugins/Page.hpp
+++ b/plugins/Page.hpp
@@ -63,6 +63,7 @@ namespace QuickMedia {
virtual sf::Vector2i get_thumbnail_max_size() { return sf::Vector2i(480, 360); };
Program *program;
+ std::shared_ptr<BodyItem> submit_body_item; // TODO: Remove this
};
enum class TrackResult {
@@ -106,5 +107,6 @@ namespace QuickMedia {
virtual std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program, const std::string &video_url, const std::string &video_title) = 0;
// Return nullptr if the service doesn't support channels page
virtual std::unique_ptr<LazyFetchPage> create_channels_page(Program *program, const std::string &channel_url) = 0;
+ virtual std::string get_url() = 0;
};
} \ No newline at end of file
diff --git a/plugins/Pornhub.hpp b/plugins/Pornhub.hpp
index 5c3f835..87e33da 100644
--- a/plugins/Pornhub.hpp
+++ b/plugins/Pornhub.hpp
@@ -21,7 +21,7 @@ namespace QuickMedia {
class PornhubVideoPage : public VideoPage {
public:
- PornhubVideoPage(Program *program) : VideoPage(program) {}
+ PornhubVideoPage(Program *program, const std::string &url) : VideoPage(program), url(url) {}
const char* get_title() const override { return ""; }
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;
@@ -29,5 +29,8 @@ namespace QuickMedia {
std::unique_ptr<LazyFetchPage> create_channels_page(Program*, const std::string&) override {
return nullptr;
}
+ std::string get_url() override { return url; }
+ private:
+ std::string url;
};
} \ No newline at end of file
diff --git a/plugins/Soundcloud.hpp b/plugins/Soundcloud.hpp
new file mode 100644
index 0000000..4962c04
--- /dev/null
+++ b/plugins/Soundcloud.hpp
@@ -0,0 +1,56 @@
+#pragma once
+
+#include "Page.hpp"
+
+namespace QuickMedia {
+ class SoundcloudPage : public Page {
+ public:
+ SoundcloudPage(Program *program) : Page(program) {}
+ virtual ~SoundcloudPage() = default;
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ };
+
+ class SoundcloudSearchPage : public SoundcloudPage {
+ public:
+ SoundcloudSearchPage(Program *program) : SoundcloudPage(program) {}
+ const char* get_title() const override { return "Search"; }
+ bool search_is_filter() override { return false; }
+ SearchResult search(const std::string &str, BodyItems &result_items) override;
+ PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
+ private:
+ std::string query_urn;
+ };
+
+ class SoundcloudUserPage : public SoundcloudPage {
+ public:
+ SoundcloudUserPage(Program *program, const std::string &username, const std::string &userpage_url, std::string next_href) : SoundcloudPage(program), username(username), userpage_url(userpage_url), next_href(std::move(next_href)), current_page(0) {}
+ const char* get_title() const override { return username.c_str(); }
+ PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
+ private:
+ PluginResult get_continuation_page(BodyItems &result_items);
+ private:
+ std::string username;
+ std::string userpage_url;
+ std::string next_href;
+ int current_page;
+ };
+
+ class SoundcloudPlaylistPage : public SoundcloudPage {
+ public:
+ SoundcloudPlaylistPage(Program *program, const std::string &playlist_name) : SoundcloudPage(program), playlist_name(playlist_name) {}
+ const char* get_title() const override { return playlist_name.c_str(); }
+ private:
+ std::string playlist_name;
+ };
+
+ class SoundcloudAudioPage : public VideoPage {
+ public:
+ SoundcloudAudioPage(Program *program, const std::string &url) : VideoPage(program), url(url) {}
+ const char* get_title() const override { return ""; }
+ std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *, const std::string &, const std::string &) override { return nullptr; }
+ std::unique_ptr<LazyFetchPage> create_channels_page(Program *, const std::string &) override { return nullptr; }
+ std::string get_url() override { return url; }
+ private:
+ std::string url;
+ };
+} \ No newline at end of file
diff --git a/plugins/Spotify.hpp b/plugins/Spotify.hpp
index 9cdd2af..89f8f3d 100644
--- a/plugins/Spotify.hpp
+++ b/plugins/Spotify.hpp
@@ -38,9 +38,12 @@ namespace QuickMedia {
class SpotifyAudioPage : public VideoPage {
public:
- SpotifyAudioPage(Program *program) : VideoPage(program) {}
+ SpotifyAudioPage(Program *program, const std::string &url) : VideoPage(program), url(url) {}
const char* get_title() const override { return ""; }
std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *, const std::string &, const std::string &) override { return nullptr; }
std::unique_ptr<LazyFetchPage> create_channels_page(Program *, const std::string &) override { return nullptr; }
+ std::string get_url() override { return url; }
+ private:
+ std::string url;
};
} \ No newline at end of file
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index f8a5d5f..4691f04 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -75,15 +75,17 @@ namespace QuickMedia {
class YoutubeVideoPage : public VideoPage {
public:
- YoutubeVideoPage(Program *program) : VideoPage(program) {}
+ YoutubeVideoPage(Program *program, const std::string &url) : VideoPage(program), url(url) {}
const char* get_title() const override { return ""; }
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<Page> create_comments_page(Program *program) 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;
+ std::string get_url() override { return url; }
private:
std::string xsrf_token;
std::string comments_continuation_token;
+ std::string url;
};
} \ No newline at end of file