diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-09-04 05:01:36 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-09-04 08:44:51 +0200 |
commit | 87c8a2986d468a3fc897169c1b00fc4695e09d39 (patch) | |
tree | bfd1d39d84680389a2bd30c9e1cdde5e844a3a5b /plugins | |
parent | 84f501f5211f09a09fc5384bf15415d0d0445a96 (diff) |
Add dramacool
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/DramaCool.hpp | 32 | ||||
-rw-r--r-- | plugins/Lbry.hpp | 2 | ||||
-rw-r--r-- | plugins/MediaGeneric.hpp | 2 | ||||
-rw-r--r-- | plugins/Page.hpp | 12 | ||||
-rw-r--r-- | plugins/Peertube.hpp | 2 | ||||
-rw-r--r-- | plugins/Soundcloud.hpp | 2 | ||||
-rw-r--r-- | plugins/Youtube.hpp | 2 |
7 files changed, 47 insertions, 7 deletions
diff --git a/plugins/DramaCool.hpp b/plugins/DramaCool.hpp new file mode 100644 index 0000000..428e632 --- /dev/null +++ b/plugins/DramaCool.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include "Page.hpp" + +namespace QuickMedia { + class DramaCoolSearchPage : public Page { + public: + DramaCoolSearchPage(Program *program) : Page(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 submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override; + }; + + class DramaCoolEpisodesPage : public Page { + public: + DramaCoolEpisodesPage(Program *program) : Page(program) {} + const char* get_title() const override { return "Search"; } + bool search_is_filter() override { return true; } + PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override; + }; + + class DramaCoolVideoPage : public VideoPage { + public: + DramaCoolVideoPage(Program *program, std::string url, std::string title, std::string referer) : VideoPage(program, std::move(url), false), title(std::move(title)), referer(std::move(referer)) {} + const char* get_title() const override { return title.c_str(); } + PluginResult load(const SubmitArgs &args, VideoInfo &video_info, std::string &err_str) override; + private: + std::string title; + std::string referer; + }; +} diff --git a/plugins/Lbry.hpp b/plugins/Lbry.hpp index 6198a9b..0eeaf86 100644 --- a/plugins/Lbry.hpp +++ b/plugins/Lbry.hpp @@ -41,7 +41,7 @@ namespace QuickMedia { 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; - PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override; + PluginResult load(const SubmitArgs &args, VideoInfo &video_info, std::string &err_str) override; private: std::string title; std::string streaming_url; diff --git a/plugins/MediaGeneric.hpp b/plugins/MediaGeneric.hpp index d9708aa..dabe08d 100644 --- a/plugins/MediaGeneric.hpp +++ b/plugins/MediaGeneric.hpp @@ -96,7 +96,7 @@ namespace QuickMedia { 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; - PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override; + PluginResult load(const SubmitArgs &args, VideoInfo &video_info, std::string &err_str) override; private: MediaGenericSearchPage *search_page; std::string video_url; diff --git a/plugins/Page.hpp b/plugins/Page.hpp index 6ac0450..2fa2b6c 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -134,6 +134,14 @@ namespace QuickMedia { std::string title; }; + struct VideoInfo { + std::string title; + std::string channel_url; + double duration = 0.0; + std::vector<MediaChapter> chapters; + std::string referer; + }; + class VideoPage : public Page { public: VideoPage(Program *program, std::string url, bool autoplay = true) : Page(program), url(std::move(url)), autoplay(autoplay) {} @@ -169,8 +177,8 @@ namespace QuickMedia { virtual std::string url_get_playable_url(const std::string &url) { return url; } virtual bool video_should_be_skipped(const std::string &url) { (void)url; return false; } // This needs to be called before the other functions are called - virtual PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) { - (void)args; (void)title; (void)duration; (void)channel_url; (void)chapters; (void)err_str; + virtual PluginResult load(const SubmitArgs &args, VideoInfo &video_info, std::string &err_str) { + (void)args; (void)video_info; (void)err_str; return PluginResult::OK; } virtual void mark_watched() {}; diff --git a/plugins/Peertube.hpp b/plugins/Peertube.hpp index ac1a06b..3028db8 100644 --- a/plugins/Peertube.hpp +++ b/plugins/Peertube.hpp @@ -81,7 +81,7 @@ namespace QuickMedia { 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; - PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override; + PluginResult load(const SubmitArgs &args, VideoInfo &video_info, std::string &err_str) override; bool autoplay_next_item() override { return autoplay_next; } //void get_subtitles(SubtitleData &subtitle_data) override; private: diff --git a/plugins/Soundcloud.hpp b/plugins/Soundcloud.hpp index cf1d7dd..b6f4933 100644 --- a/plugins/Soundcloud.hpp +++ b/plugins/Soundcloud.hpp @@ -60,7 +60,7 @@ namespace QuickMedia { public: SoundcloudAudioPage(Program *program, std::string title, const std::string &url, std::string permalink_url) : VideoPage(program, url), title(std::move(title)), permalink_url(std::move(permalink_url)) {} const char* get_title() const override { return ""; } - PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override; + PluginResult load(const SubmitArgs &args, VideoInfo &video_info, std::string &err_str) override; bool autoplay_next_item() override { return true; } std::string url_get_playable_url(const std::string &url) override; std::string get_download_url(int max_height) override; diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index cea5d8d..1e84af1 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -151,7 +151,7 @@ namespace QuickMedia { std::string get_url_timestamp() 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; - PluginResult load(const SubmitArgs &args, std::string &title, std::string &channel_url, double &duration, std::vector<MediaChapter> &chapters, std::string &err_str) override; + PluginResult load(const SubmitArgs &args, VideoInfo &video_info, std::string &err_str) override; void mark_watched() override; void get_subtitles(SubtitleData &subtitle_data) override; void set_watch_progress(int64_t time_pos_sec, int64_t duration_sec) override; |