From 5394d8e2c85b52d7375a02f72e089d22a82fba1b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 21 Dec 2020 20:47:59 +0100 Subject: Add pipe plugin, increase video load timeout to 500 seconds --- src/plugins/Pipe.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/plugins/Pipe.cpp (limited to 'src/plugins/Pipe.cpp') diff --git a/src/plugins/Pipe.cpp b/src/plugins/Pipe.cpp new file mode 100644 index 0000000..5d7d269 --- /dev/null +++ b/src/plugins/Pipe.cpp @@ -0,0 +1,33 @@ +#include "../../plugins/Pipe.hpp" +#include +#include + +namespace QuickMedia { + PluginResult PipePage::submit(const std::string &title, const std::string&, std::vector &result_tabs) { + puts(title.c_str()); + return PluginResult::OK; + } + + // static + void PipePage::load_body_items_from_stdin(BodyItems &items) { + std::string line; + while(std::getline(std::cin, line)) { + std::string name; + std::string filepath; + size_t split_index = line.find('|'); + if(split_index == std::string::npos) { + name = std::move(line); + } else { + name = line.substr(0, split_index); + filepath = line.substr(split_index + 1); + } + + auto body_item = BodyItem::create(std::move(name)); + if(!filepath.empty()) { + body_item->thumbnail_url = std::move(filepath); + body_item->thumbnail_is_local = true; + } + items.push_back(std::move(body_item)); + } + } +} \ No newline at end of file -- cgit v1.2.3