aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-03-24 20:31:59 +0100
committerdec05eba <dec05eba@protonmail.com>2022-03-24 20:31:59 +0100
commit8e23c088ceebd1308e0f32b584ae503495895b05 (patch)
tree879c8a3414afdbc473704ce8d718c8147c25d5cc /src
parentce00471fd84745dcbbcb9f2d9ef434acb3d0fd2b (diff)
Add youtube.load_progress option
Diffstat (limited to 'src')
-rw-r--r--src/Config.cpp7
-rw-r--r--src/plugins/Youtube.cpp4
2 files changed, 11 insertions, 0 deletions
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 <optional>
#include <json/reader.h>
@@ -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());