aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Pipe.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-12-21 20:47:59 +0100
committerdec05eba <dec05eba@protonmail.com>2020-12-21 20:47:59 +0100
commit5394d8e2c85b52d7375a02f72e089d22a82fba1b (patch)
tree3d14614b85b28a78edfe269a696daf02bc51de15 /src/plugins/Pipe.cpp
parent4f8e4d11e51e2436b957157de86755f5f8879f61 (diff)
Add pipe plugin, increase video load timeout to 500 seconds
Diffstat (limited to 'src/plugins/Pipe.cpp')
-rw-r--r--src/plugins/Pipe.cpp33
1 files changed, 33 insertions, 0 deletions
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 <string>
+#include <iostream>
+
+namespace QuickMedia {
+ PluginResult PipePage::submit(const std::string &title, const std::string&, std::vector<Tab> &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