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/QuickMedia.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index db0f9f6..1191ecb 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -9,6 +9,7 @@ #include "../plugins/Matrix.hpp" #include "../plugins/Pleroma.hpp" #include "../plugins/FileManager.hpp" +#include "../plugins/Pipe.hpp" #include "../include/Scale.hpp" #include "../include/Program.hpp" #include "../include/VideoPlayer.hpp" @@ -396,7 +397,7 @@ namespace QuickMedia { static void usage() { fprintf(stderr, "usage: QuickMedia [--tor] [--no-video] [--use-system-mpv-config] [--dir ]\n"); fprintf(stderr, "OPTIONS:\n"); - fprintf(stderr, " plugin The plugin to use. Should be either 4chan, manganelo, mangatown, mangadex, pornhub, youtube, nyaa.si, matrix or file-manager\n"); + fprintf(stderr, " plugin The plugin to use. Should be either 4chan, manganelo, mangatown, mangadex, pornhub, youtube, nyaa.si, matrix, file-manager or pipe\n"); fprintf(stderr, " --no-video Only play audio when playing a video. Disabled by default\n"); fprintf(stderr, " --tor Use tor. Disabled by default\n"); fprintf(stderr, " --use-system-mpv-config Use system mpv config instead of no config. Disabled by default\n"); @@ -455,6 +456,8 @@ namespace QuickMedia { plugin_logo_path = resources_root + "images/pleroma_logo.png"; } else if(strcmp(argv[i], "file-manager") == 0) { plugin_name = argv[i]; + } else if(strcmp(argv[i], "pipe") == 0) { + plugin_name = argv[i]; } } @@ -597,6 +600,10 @@ namespace QuickMedia { auto file_manager_body = create_body(); file_manager_page->get_files_in_directory(file_manager_body->items); tabs.push_back(Tab{std::move(file_manager_body), std::move(file_manager_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); + } else if(strcmp(plugin_name, "pipe") == 0) { + auto pipe_body = create_body(); + PipePage::load_body_items_from_stdin(pipe_body->items); + tabs.push_back(Tab{std::move(pipe_body), std::make_unique(this), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); } else if(strcmp(plugin_name, "youtube") == 0) { auto search_body = create_body(); tabs.push_back(Tab{std::move(search_body), std::make_unique(this), create_search_bar("Search...", 350)}); @@ -1817,8 +1824,6 @@ namespace QuickMedia { window_size.y = event.size.height; sf::FloatRect visible_area(0, 0, window_size.x, window_size.y); window.setView(sf::View(visible_area)); - } else if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) { - current_page = previous_page; } } -- cgit v1.2.3