From e4792f46d545263d16db21bd0caf71345a69b63f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 22 Jun 2021 16:07:20 +0200 Subject: Only do youtube redirect on failure to load video --- include/DownloadUtils.hpp | 2 +- include/VideoPlayer.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/DownloadUtils.hpp b/include/DownloadUtils.hpp index 28684ef..498b976 100644 --- a/include/DownloadUtils.hpp +++ b/include/DownloadUtils.hpp @@ -24,7 +24,7 @@ namespace QuickMedia { DownloadResult download_head_to_string(const std::string &url, std::string &result, bool use_browser_useragent = false, bool fail_on_error = true); // Returns the remote name from the content-disposition header or tries to extract the file name from url. Can return empty name DownloadResult url_get_remote_name(const std::string &url, std::string &result, bool use_browser_useragent); - DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector &additional_args, bool use_browser_useragent = false, bool fail_on_error = true); + DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector &additional_args, bool use_browser_useragent = false, bool fail_on_error = true, std::string *header = nullptr, int download_limit = 1024 * 1024 * 100); // 100mb download limit // Note: This function saves the content to the file atomically DownloadResult download_to_string_cache(const std::string &url, std::string &result, const std::vector &additional_args, bool use_browser_useragent = false, DownloadErrorHandler error_handler = nullptr, Path cache_path = ""); // Note: This function saves the content to the file atomically diff --git a/include/VideoPlayer.hpp b/include/VideoPlayer.hpp index 1a1e418..97e4b61 100644 --- a/include/VideoPlayer.hpp +++ b/include/VideoPlayer.hpp @@ -33,7 +33,7 @@ namespace QuickMedia { }; // @event_callback is called from another thread - VideoPlayer(bool no_video, bool use_system_mpv_config, bool keep_open, EventCallbackFunc event_callback, VideoPlayerWindowCreateCallback window_create_callback, const std::string &resource_root, int monitor_height); + VideoPlayer(bool no_video, bool use_system_mpv_config, bool keep_open, EventCallbackFunc event_callback, VideoPlayerWindowCreateCallback window_create_callback, const std::string &resource_root, int monitor_height, std::string plugin_name); ~VideoPlayer(); VideoPlayer(const VideoPlayer&) = delete; VideoPlayer& operator=(const VideoPlayer&) = delete; @@ -55,6 +55,7 @@ namespace QuickMedia { Error launch_video_process(const char *path, const char *audio_path, sf::WindowHandle parent_window, bool is_youtube, const std::string &title, const std::string &start_time); VideoPlayer::Error read_ipc_func(); private: + std::string plugin_name; bool no_video; bool use_system_mpv_config; bool keep_open; -- cgit v1.2.3