diff options
Diffstat (limited to 'src/VideoPlayer.cpp')
-rw-r--r-- | src/VideoPlayer.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index c30f147..48b7f52 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -1,5 +1,6 @@ #include "../include/VideoPlayer.hpp" #include "../include/Program.h" +#include "../include/Storage.hpp" #include <string> #include <json/reader.h> #include <json/writer.h> @@ -56,7 +57,7 @@ namespace QuickMedia { XCloseDisplay(display); } - VideoPlayer::Error VideoPlayer::launch_video_process(const char *path, sf::WindowHandle _parent_window) { + VideoPlayer::Error VideoPlayer::launch_video_process(const char *path, sf::WindowHandle _parent_window, const std::string &plugin_name) { parent_window = _parent_window; if(!tmpnam(ipc_server_path)) { @@ -90,6 +91,17 @@ namespace QuickMedia { }); } + std::string cookies_file_arg; + if(!plugin_name.empty()) { + Path cookies_filepath; + if(get_cookies_filepath(cookies_filepath, plugin_name) != 0) { + fprintf(stderr, "Warning: Failed to create %s cookies file\n", plugin_name.c_str()); + } else { + cookies_file_arg = "--cookies-file=" + cookies_filepath.data; + args.insert(args.end(), { "--cookies", cookies_file_arg.c_str() }); + } + } + args.insert(args.end(), { "--", path, nullptr }); if(exec_program_async(args.data(), &video_process_id) != 0) @@ -111,12 +123,12 @@ namespace QuickMedia { return Error::OK; } - VideoPlayer::Error VideoPlayer::load_video(const char *path, sf::WindowHandle _parent_window) { + VideoPlayer::Error VideoPlayer::load_video(const char *path, sf::WindowHandle _parent_window, const std::string &plugin_name) { // This check is to make sure we dont change window that the video belongs to. This is not a usecase we will have so // no need to support it for now at least. assert(parent_window == 0 || parent_window == _parent_window); if(video_process_id == -1) - return launch_video_process(path, _parent_window); + return launch_video_process(path, _parent_window, plugin_name); Json::Value command_data(Json::arrayValue); command_data.append("loadfile"); |