diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 16 | ||||
-rw-r--r-- | src/plugins/Youtube.cpp | 8 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 2157a4d..1b48743 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -2254,7 +2254,7 @@ namespace QuickMedia { more_items_above_rect.setSize(sf::Vector2f(window_size.x, more_items_height)); more_items_below_rect.setPosition(sf::Vector2f(0.0f, window_size.y - more_items_height)); - more_items_below_rect.setSize(sf::Vector2f(window_size.y, more_items_height)); + more_items_below_rect.setSize(sf::Vector2f(window_size.x, more_items_height)); } if(tab_associated_data[selected_tab].fetching_next_page_running) { @@ -2815,12 +2815,13 @@ namespace QuickMedia { audio_url.clear(); has_embedded_audio = true; + std::string err_str; const int num_retries = is_youtube ? 3 : 1; bool load_successful = false; for(int i = 0; i < num_retries; ++i) { bool cancelled = false; TaskResult load_result = run_task_with_loading_screen([&]() { - if(video_page->load(new_title, channel_url, media_chapters) != PluginResult::OK) + if(video_page->load(new_title, channel_url, media_chapters, err_str) != PluginResult::OK) return false; std::string ext; @@ -2880,7 +2881,7 @@ namespace QuickMedia { } if(!load_successful) { - show_notification("QuickMedia", "Failed to load media", Urgency::CRITICAL); + show_notification("QuickMedia", "Failed to load media" + (err_str.empty() ? "" : ", error: " + err_str), Urgency::CRITICAL); current_page = previous_page; go_to_previous_page = true; return; @@ -4420,7 +4421,7 @@ namespace QuickMedia { more_items_above_rect.setSize(sf::Vector2f(window_size.x, more_items_height)); more_items_below_rect.setPosition(sf::Vector2f(0.0f, window_size.y - more_items_height)); - more_items_below_rect.setSize(sf::Vector2f(window_size.y, more_items_height)); + more_items_below_rect.setSize(sf::Vector2f(window_size.x, more_items_height)); } //comment_input.update(); @@ -7163,12 +7164,13 @@ namespace QuickMedia { bool load_successful = false; const int largest_monitor_height = get_largest_monitor_height(disp); + std::string err_str; for(int i = 0; i < 3; ++i) { - task_result = run_task_with_loading_screen([this, &youtube_video_page, &filename, &video_url, &audio_url, &video_content_length, &audio_content_length, largest_monitor_height, &cancelled]{ + task_result = run_task_with_loading_screen([&]{ std::string channel_url; std::vector<MediaChapter> chapters; filename.clear(); - if(youtube_video_page->load(filename, channel_url, chapters) != PluginResult::OK) + if(youtube_video_page->load(filename, channel_url, chapters, err_str) != PluginResult::OK) return false; std::string ext; @@ -7218,7 +7220,7 @@ namespace QuickMedia { } if(!load_successful) { - show_notification("QuickMedia", "Download failed", Urgency::CRITICAL); + show_notification("QuickMedia", "Download failed" + (err_str.empty() ? "" : ", error: " + err_str), Urgency::CRITICAL); exit_code = 1; return; } 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<MediaChapter> &chapters) { + PluginResult YoutubeVideoPage::parse_video_response(const Json::Value &json_root, std::string &title, std::string &channel_url, std::vector<MediaChapter> &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<MediaChapter> &chapters) { + PluginResult YoutubeVideoPage::load(std::string &title, std::string &channel_url, std::vector<MediaChapter> &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() { |