From aab8d467dbbe664e3f826dbcf08475839759aef9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 15 Feb 2021 02:39:31 +0100 Subject: Add spotify podcasts --- plugins/Spotify.hpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 plugins/Spotify.hpp (limited to 'plugins') diff --git a/plugins/Spotify.hpp b/plugins/Spotify.hpp new file mode 100644 index 0000000..9cdd2af --- /dev/null +++ b/plugins/Spotify.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include "Page.hpp" + +namespace QuickMedia { + class SpotifyPage : public Page { + public: + SpotifyPage(Program *program); + virtual ~SpotifyPage() = default; + protected: + DownloadResult download_json_error_retry(Json::Value &json_root, const std::string &url, std::vector additional_args); + private: + PluginResult update_token(); + private: + std::string access_token; + }; + + class SpotifyPodcastSearchPage : public SpotifyPage { + public: + SpotifyPodcastSearchPage(Program *program) : SpotifyPage(program) {} + const char* get_title() const override { return "Podcasts"; } + 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; + }; + + class SpotifyEpisodeListPage : public SpotifyPage { + public: + SpotifyEpisodeListPage(Program *program, const std::string &url) : SpotifyPage(program), url(url) {} + const char* get_title() const override { return "Episodes"; } + bool search_is_filter() override { return true; } + 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; + private: + std::string url; + }; + + class SpotifyAudioPage : public VideoPage { + public: + SpotifyAudioPage(Program *program) : VideoPage(program) {} + const char* get_title() const override { return ""; } + std::unique_ptr create_related_videos_page(Program *, const std::string &, const std::string &) override { return nullptr; } + std::unique_ptr create_channels_page(Program *, const std::string &) override { return nullptr; } + }; +} \ No newline at end of file -- cgit v1.2.3