aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Youtube.hpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index 0393739..22cb9e5 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -106,7 +106,8 @@ namespace QuickMedia {
enum class Type {
VIDEOS,
SHORTS,
- LIVE
+ LIVE,
+ PLAYLISTS
};
static void create_each_type(Program *program, std::string url, std::string continuation_token, std::string title, std::vector<Tab> &tabs);
@@ -154,9 +155,21 @@ namespace QuickMedia {
PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
};
+ class YoutubePlaylistPage : public LazyFetchPage {
+ public:
+ YoutubePlaylistPage(Program *program, std::string url, std::string title) :
+ LazyFetchPage(program), url(std::move(url)), title(std::move(title)) {}
+ const char* get_title() const override { return title.c_str(); }
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
+ PluginResult lazy_fetch(BodyItems &result_items) override;
+ private:
+ std::string url;
+ std::string title;
+ };
+
class YoutubeVideoPage : public VideoPage {
public:
- YoutubeVideoPage(Program *program, std::string url, bool autoplay = true);
+ YoutubeVideoPage(Program *program, std::string url, bool autoplay = true, bool autoplay_next_item = false);
const char* get_title() const override { return ""; }
BodyItems get_related_media(const std::string &url) override;
PluginResult get_related_pages(const BodyItems &related_videos, const std::string &channel_url, std::vector<Tab> &result_tabs) override;
@@ -170,6 +183,7 @@ namespace QuickMedia {
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;
+ bool autoplay_next_item() override { return goto_next_item; }
private:
PluginResult parse_video_response(const Json::Value &json_root, std::string &title, std::string &channel_url, std::vector<MediaChapter> &chapters, std::string &err_str);
void parse_format(const Json::Value &format_json, bool is_adaptive);
@@ -186,5 +200,6 @@ namespace QuickMedia {
std::string watchtime_url;
std::string tracking_url;
YoutubeVideoDetails video_details;
+ bool goto_next_item;
};
}