From 65cf7681a04f2511db8c7829e9828b53a6676c88 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 2 Aug 2019 20:08:27 +0200 Subject: Convert to sfml, starting on manganelo and youtube --- plugins/Manganelo.hpp | 10 ++++++++++ plugins/Plugin.hpp | 38 ++++++++++++++++++++++++++++++++++++++ plugins/Youtube.hpp | 10 ++++++++++ 3 files changed, 58 insertions(+) create mode 100644 plugins/Manganelo.hpp create mode 100644 plugins/Plugin.hpp create mode 100644 plugins/Youtube.hpp (limited to 'plugins') diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp new file mode 100644 index 0000000..fd56b85 --- /dev/null +++ b/plugins/Manganelo.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "Plugin.hpp" + +namespace QuickMedia { + class Manganelo : public Plugin { + public: + SearchResult search(const std::string &text, std::vector> &result_items) override; + }; +} \ No newline at end of file diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp new file mode 100644 index 0000000..bc518a8 --- /dev/null +++ b/plugins/Plugin.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include +#include +#include + +namespace QuickMedia { + class BodyItem { + public: + BodyItem(const std::string &_title): title(_title) { + + } + + std::string title; + std::string cover_url; + }; + + enum class SearchResult { + OK, + ERR, + NET_ERR + }; + + enum class DownloadResult { + OK, + ERR, + NET_ERR + }; + + class Plugin { + public: + virtual ~Plugin() = default; + + virtual SearchResult search(const std::string &text, std::vector> &result_items) = 0; + protected: + DownloadResult download_to_string(const std::string &url, std::string &result); + }; +} \ No newline at end of file diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp new file mode 100644 index 0000000..ea2918d --- /dev/null +++ b/plugins/Youtube.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "Plugin.hpp" + +namespace QuickMedia { + class Youtube : public Plugin { + public: + SearchResult search(const std::string &text, std::vector> &result_items) override; + }; +} \ No newline at end of file -- cgit v1.2.3