From 060db5c6cbd02e684a0c98c0f045da242b6ab218 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 9 Oct 2021 14:49:13 +0200 Subject: Add lbry, attempt to fix 4chan posting when captcha is no-op --- plugins/Fourchan.hpp | 1 - plugins/ImageBoard.hpp | 2 ++ plugins/Lbry.hpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/NyaaSi.hpp | 1 - 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 plugins/Lbry.hpp (limited to 'plugins') diff --git a/plugins/Fourchan.hpp b/plugins/Fourchan.hpp index f09c7bb..8c608a1 100644 --- a/plugins/Fourchan.hpp +++ b/plugins/Fourchan.hpp @@ -8,7 +8,6 @@ namespace QuickMedia { FourchanBoardsPage(Program *program, std::string resources_root) : Page(program), resources_root(std::move(resources_root)) {} const char* get_title() const override { return "Select board"; } PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override; - bool clear_search_after_submit() override { return true; } void get_boards(BodyItems &result_items); const std::string resources_root; diff --git a/plugins/ImageBoard.hpp b/plugins/ImageBoard.hpp index 5b299b3..7914ef1 100644 --- a/plugins/ImageBoard.hpp +++ b/plugins/ImageBoard.hpp @@ -29,6 +29,8 @@ namespace QuickMedia { const char* get_title() const override { return ""; } PageTypez get_type() const override { return PageTypez::IMAGE_BOARD_THREAD; } + void copy_to_clipboard(const BodyItem *body_item) const override; + bool autoplay_next_item() override { return true; } std::unique_ptr create_related_videos_page(Program *program) override; std::unique_ptr create_channels_page(Program*, const std::string&) override { diff --git a/plugins/Lbry.hpp b/plugins/Lbry.hpp new file mode 100644 index 0000000..ac7c4b4 --- /dev/null +++ b/plugins/Lbry.hpp @@ -0,0 +1,53 @@ +#pragma once + +#include "Page.hpp" + +namespace QuickMedia { + class LbrySearchPage : public Page { + public: + LbrySearchPage(Program *program, std::string channel_id = "") : Page(program), channel_id(std::move(channel_id)) {} + 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; + PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override; + bool submit_is_async() const override { return false; } + private: + std::string channel_id; + }; + + class LbryChannelPage : public LazyFetchPage { + public: + LbryChannelPage(Program *program, std::string title, std::string channel_id) : + LazyFetchPage(program), search_page(program, channel_id), title(std::move(title)), channel_id(std::move(channel_id)) {} + const char* get_title() const override { return title.c_str(); } + bool submit_is_async() const override { return false; } + 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; + PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override; + PluginResult lazy_fetch(BodyItems &result_items) override; + private: + LbrySearchPage search_page; + std::string title; + std::string channel_id; + }; + + class LbryVideoPage : public VideoPage { + public: + 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 create_comments_page(Program *program) override; + std::unique_ptr create_related_videos_page(Program *program) override; + std::unique_ptr 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; + PluginResult load(std::string &title, std::string &channel_url, std::vector &chapters, std::string &err_str) override; + private: + std::string title; + std::string streaming_url; + }; +} \ No newline at end of file diff --git a/plugins/NyaaSi.hpp b/plugins/NyaaSi.hpp index f113544..5556fa8 100644 --- a/plugins/NyaaSi.hpp +++ b/plugins/NyaaSi.hpp @@ -11,7 +11,6 @@ namespace QuickMedia { NyaaSiCategoryPage(Program *program, bool is_sukebei) : Page(program), is_sukebei(is_sukebei) {} const char* get_title() const override { return is_sukebei ? "Select sukebei category" : "Select nyaa.si category"; } PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override; - bool clear_search_after_submit() override { return true; } const bool is_sukebei; }; -- cgit v1.2.3