diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/MediaGeneric.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/MediaGeneric.hpp b/plugins/MediaGeneric.hpp index e4048a9..f7ff019 100644 --- a/plugins/MediaGeneric.hpp +++ b/plugins/MediaGeneric.hpp @@ -24,6 +24,14 @@ namespace QuickMedia { const char *field_contains = nullptr; }; + struct MediaRelatedItem { + std::string title; + std::string url; + std::string thumbnail_url; + }; + + using MediaRelatedCustomHandler = std::function<std::vector<MediaRelatedItem>(const std::string &html_source)>; + class MediaGenericSearchPage : public Page { public: MediaGenericSearchPage(Program *program, const char *website_url, sf::Vector2i thumbnail_max_size); @@ -49,6 +57,8 @@ namespace QuickMedia { MediaGenericSearchPage& related_media_text_handler(std::vector<MediaTextQuery> queries); // This is optional. MediaGenericSearchPage& related_media_thumbnail_handler(std::vector<MediaThumbnailQuery> queries); + // This is optional. + MediaGenericSearchPage& related_media_custom_handler(MediaRelatedCustomHandler handler); private: std::string website_url; sf::Vector2i thumbnail_max_size; @@ -57,6 +67,7 @@ namespace QuickMedia { std::vector<MediaThumbnailQuery> thumbnail_queries; std::vector<MediaTextQuery> related_media_text_queries; std::vector<MediaThumbnailQuery> related_media_thumbnail_queries; + MediaRelatedCustomHandler related_custom_handler = nullptr; }; class MediaGenericRelatedPage : public RelatedVideosPage { |