From 8e23c088ceebd1308e0f32b584ae503495895b05 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 24 Mar 2022 20:31:59 +0100 Subject: Add youtube.load_progress option --- src/Config.cpp | 7 +++++++ src/plugins/Youtube.cpp | 4 ++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/Config.cpp b/src/Config.cpp index a1752b1..e0f39fd 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -178,6 +178,13 @@ namespace QuickMedia { config->local_anime.auto_group_episodes = auto_group_episodes_json.asBool(); } + const Json::Value &youtube_json = json_root["youtube"]; + if(youtube_json.isObject()) { + const Json::Value &load_progress_json = youtube_json["load_progress"]; + if(load_progress_json.isBool()) + config->youtube.load_progress = load_progress_json.asBool(); + } + const Json::Value &use_system_fonts_json = json_root["use_system_fonts"]; if(use_system_fonts_json.isBool()) config->use_system_fonts = use_system_fonts_json.asBool(); diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index bbf3108..f8e39cf 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -7,6 +7,7 @@ #include "../../include/VideoPlayer.hpp" #include "../../include/Utils.hpp" #include "../../include/Theme.hpp" +#include "../../include/Config.hpp" #include "../../plugins/WatchProgress.hpp" #include #include @@ -1863,6 +1864,9 @@ namespace QuickMedia { if(!timestamp.empty()) return timestamp; + if(!get_config().youtube.load_progress) + return ""; + std::string video_id; if(!youtube_url_extract_id(url, video_id)) { fprintf(stderr, "Failed to extract youtube id from %s\n", url.c_str()); -- cgit v1.2.3