aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-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