aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index bf6cf7e..a4ea258 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2412,7 +2412,6 @@ namespace QuickMedia {
if(create_directory_recursive(video_cache_dir) != 0) {
show_notification("QuickMedia", "Failed to create video cache directory", Urgency::CRITICAL);
current_page = previous_page;
- go_to_previous_page = true;
return false;
}
@@ -2435,18 +2434,15 @@ namespace QuickMedia {
case TaskResult::FALSE: {
show_notification("QuickMedia", "Failed to download " + video_url, Urgency::CRITICAL);
current_page = previous_page;
- go_to_previous_page = true;
return false;
}
case TaskResult::CANCEL: {
current_page = previous_page;
- go_to_previous_page = true;
return false;
}
}
} else if(video_is_not_streamble_result == TaskResult::CANCEL) {
current_page = previous_page;
- go_to_previous_page = true;
return false;
}
}
@@ -2496,8 +2492,9 @@ namespace QuickMedia {
const int num_load_tries_max = 3;
int load_try = 0;
std::string prev_start_time;
+ std::vector<MediaChapter> media_chapters;
- auto load_video_error_check = [this, &prev_start_time, &in_seeking, &video_url, &audio_url, &video_title, &video_tasks, &channel_url, previous_page, &go_to_previous_page, &video_loaded, video_page, &video_event_callback, &on_window_create, &video_player_window, is_youtube, is_matrix, download_if_streaming_fails](std::string start_time = "", bool reuse_media_source = false) mutable {
+ auto load_video_error_check = [this, &prev_start_time, &media_chapters, &in_seeking, &video_url, &audio_url, &video_title, &video_tasks, &channel_url, previous_page, &go_to_previous_page, &video_loaded, video_page, &video_event_callback, &on_window_create, &video_player_window, is_youtube, is_matrix, download_if_streaming_fails](std::string start_time = "", bool reuse_media_source = false) mutable {
video_player.reset();
channel_url.clear();
video_loaded = false;
@@ -2510,8 +2507,8 @@ namespace QuickMedia {
if(!reuse_media_source) {
std::string new_title;
- TaskResult load_result = run_task_with_loading_screen([video_page, &new_title, &channel_url]() {
- return video_page->load(new_title, channel_url) == PluginResult::OK;
+ TaskResult load_result = run_task_with_loading_screen([video_page, &new_title, &channel_url, &media_chapters]() {
+ return video_page->load(new_title, channel_url, media_chapters) == PluginResult::OK;
});
if(!new_title.empty())
@@ -2547,8 +2544,10 @@ namespace QuickMedia {
}
if(!is_youtube && download_if_streaming_fails) {
- if(!video_download_if_non_streamable(video_url, audio_url, is_audio_only, has_embedded_audio, previous_page))
+ if(!video_download_if_non_streamable(video_url, audio_url, is_audio_only, has_embedded_audio, previous_page)) {
+ go_to_previous_page = true;
return;
+ }
}
}
@@ -2560,7 +2559,7 @@ namespace QuickMedia {
watched_videos.insert(video_page->get_url());
video_player = std::make_unique<VideoPlayer>(is_audio_only, use_system_mpv_config, is_matrix && !is_youtube, video_event_callback, on_window_create, resources_root, largest_monitor_height);
- VideoPlayer::Error err = video_player->load_video(video_url.c_str(), audio_url.c_str(), window.getSystemHandle(), is_youtube, video_title, start_time);
+ VideoPlayer::Error err = video_player->load_video(video_url.c_str(), audio_url.c_str(), window.getSystemHandle(), is_youtube, video_title, start_time, media_chapters);
if(err != VideoPlayer::Error::OK) {
std::string err_msg = "Failed to play url: ";
err_msg += video_page->get_url();
@@ -3722,6 +3721,7 @@ namespace QuickMedia {
comment_page_scroll_stack.clear();
}
redraw = true;
+ idle_active_handler();
} else {
BodyItem *selected_item = thread_body->get_selected();
if(selected_item && !selected_item->url.empty()) {
@@ -6446,7 +6446,7 @@ namespace QuickMedia {
bool start() override {
remove(output_filepath.c_str());
- std::vector<const char*> args = { "youtube-dl", "--no-warnings", "--no-continue", "--output", output_filepath.c_str(), "--newline" };
+ std::vector<const char*> args = { "youtube-dl", "-f", "bestvideo+bestaudio/best", "--no-warnings", "--no-continue", "--output", output_filepath.c_str(), "--newline" };
if(no_video) args.push_back("-x");
args.insert(args.end(), { "--", url.c_str(), nullptr });
@@ -6573,7 +6573,7 @@ namespace QuickMedia {
if(download_use_youtube_dl) {
task_result = run_task_with_loading_screen([this, url, &filename]{
std::string json_str;
- std::vector<const char*> args = { "youtube-dl", "--skip-download", "--print-json", "--no-warnings" };
+ std::vector<const char*> args = { "youtube-dl", "-f", "bestvideo+bestaudio/best", "--skip-download", "--print-json", "--no-warnings" };
if(no_video) args.push_back("-x");
args.insert(args.end(), { "--", url, nullptr });
if(exec_program(args.data(), accumulate_string, &json_str) != 0)