From 3f0421bea6b37d81d2d66c001b0fac2df91dd702 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 3 Sep 2021 03:54:00 +0200 Subject: Show youtube play fail reason in notification, more items below correct width! --- src/plugins/Youtube.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 34fd250..d308346 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -2321,7 +2321,7 @@ namespace QuickMedia { } } - PluginResult YoutubeVideoPage::parse_video_response(const Json::Value &json_root, std::string &title, std::string &channel_url, std::vector &chapters) { + PluginResult YoutubeVideoPage::parse_video_response(const Json::Value &json_root, std::string &title, std::string &channel_url, std::vector &chapters, std::string &err_str) { livestream_url.clear(); video_formats.clear(); audio_formats.clear(); @@ -2338,6 +2338,8 @@ namespace QuickMedia { const Json::Value &status_json = playability_status_json["status"]; if(status_json.isString() && (strcmp(status_json.asCString(), "UNPLAYABLE") == 0 || strcmp(status_json.asCString(), "LOGIN_REQUIRED") == 0)) { const Json::Value &reason_json = playability_status_json["reason"]; + if(reason_json.isString()) + err_str = reason_json.asString(); fprintf(stderr, "Unable to play video, status: %s, reason: %s\n", status_json.asCString(), reason_json.isString() ? reason_json.asCString() : "Unknown"); return PluginResult::ERR; } @@ -2432,7 +2434,7 @@ namespace QuickMedia { return PluginResult::OK; } - PluginResult YoutubeVideoPage::load(std::string &title, std::string &channel_url, std::vector &chapters) { + PluginResult YoutubeVideoPage::load(std::string &title, std::string &channel_url, std::vector &chapters, std::string &err_str) { livestream_url.clear(); video_formats.clear(); audio_formats.clear(); @@ -2479,7 +2481,7 @@ R"END( DownloadResult download_result = download_json(json_root, "https://www.youtube.com/youtubei/v1/player?key=" + api_key + "&gl=US&hl=en", additional_args, true); if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result); - return parse_video_response(json_root, title, channel_url, chapters); + return parse_video_response(json_root, title, channel_url, chapters, err_str); } void YoutubeVideoPage::mark_watched() { -- cgit v1.2.3