diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-02 20:08:27 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-08-02 20:08:27 +0200 |
commit | 65cf7681a04f2511db8c7829e9828b53a6676c88 (patch) | |
tree | 6e7db509cf2bce4a10fa6d8bc89a9eae88d893fa /src/Plugin.cpp | |
parent | 109c797d7c89223c9eed07dc322448b5c5fe3373 (diff) |
Convert to sfml, starting on manganelo and youtube
Diffstat (limited to 'src/Plugin.cpp')
-rw-r--r-- | src/Plugin.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Plugin.cpp b/src/Plugin.cpp new file mode 100644 index 0000000..d2fe925 --- /dev/null +++ b/src/Plugin.cpp @@ -0,0 +1,17 @@ +#include "../plugins/Plugin.hpp" +#include "../include/Program.h" + +static int accumulate_string(char *data, int size, void *userdata) { + std::string *str = (std::string*)userdata; + str->append(data, size); + return 0; +} + +namespace QuickMedia { + DownloadResult Plugin::download_to_string(const std::string &url, std::string &result) { + const char *args[] = { "curl", "-H", "Accept-Language: en-US,en;q=0.5", "--compressed", "-s", "-L", url.c_str(), nullptr }; + if(exec_program(args, accumulate_string, &result) != 0) + return DownloadResult::NET_ERR; + return DownloadResult::OK; + } +}
\ No newline at end of file |