From ceb1a46b665440c45b97071a8b233ff44275ddaf Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 3 Apr 2024 21:14:43 +0200 Subject: Sponsorblock: add api_endpoint option --- example-config.json | 1 + include/Config.hpp | 1 + src/Config.cpp | 1 + src/plugins/Youtube.cpp | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/example-config.json b/example-config.json index 8a28b89..695b60d 100644 --- a/example-config.json +++ b/example-config.json @@ -52,6 +52,7 @@ "invidious_instance": "", "sponsorblock": { "enable": false, + "api_endpoint": "https://sponsor.ajay.app", // If the sponsor segment has less votes than this in sponsorblock then it will be ignored "min_votes": 0 } diff --git a/include/Config.hpp b/include/Config.hpp index 11d7679..53d2d46 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -51,6 +51,7 @@ namespace QuickMedia { struct YoutubeSponsorblock { bool enable = false; + std::string api_endpoint = "https://sponsor.ajay.app"; int min_votes = 0; }; diff --git a/src/Config.cpp b/src/Config.cpp index cc1c476..8a9752d 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -284,6 +284,7 @@ namespace QuickMedia { const Json::Value &sponsorblock_json = youtube_json["sponsorblock"]; if(sponsorblock_json.isObject()) { get_json_value(sponsorblock_json, "enable", config->youtube.sponsorblock.enable); + get_json_value(sponsorblock_json, "api_endpoint", config->youtube.sponsorblock.api_endpoint); get_json_value(sponsorblock_json, "min_votes", config->youtube.sponsorblock.min_votes); } } diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index bcb6cf6..1a29110 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -3072,7 +3072,7 @@ namespace QuickMedia { return; } - const std::string sponsorblock_url = "https://sponsor.ajay.app/api/skipSegments?videoID=" + video_id; + const std::string sponsorblock_url = get_config().youtube.sponsorblock.api_endpoint + "/api/skipSegments?videoID=" + video_id; Json::Value json_root; if(page->download_json(json_root, sponsorblock_url, {}) != DownloadResult::OK) return; -- cgit v1.2.3