diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DownloadUtils.cpp | 16 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 6 | ||||
-rw-r--r-- | src/plugins/Peertube.cpp | 8 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp index a56a56e..93df291 100644 --- a/src/DownloadUtils.cpp +++ b/src/DownloadUtils.cpp @@ -136,18 +136,18 @@ namespace QuickMedia { fprintf(stderr, "Download duration for %s: %d ms\n", url.c_str(), timer.getElapsedTime().asMilliseconds()); std::string content_disposition = header_extract_value(header, "content-disposition"); - size_t filename_start = content_disposition.find("filename="); + // TODO: after filename*= the encoding type will follow. We need to support other formats than utf-8 as well + size_t filename_start = content_disposition.find("filename*="); if(filename_start == std::string::npos) { - // TODO: after filename*= the encoding type will follow. We need to support other formats than utf-8 as well - filename_start = content_disposition.find("filename*="); + filename_start = content_disposition.find("filename="); if(filename_start != std::string::npos) { - filename_start += 10; - filename_start = content_disposition.find("''", filename_start); - if(filename_start != std::string::npos) - filename_start += 2; + filename_start += 9; } } else { - filename_start += 9; + filename_start += 10; + filename_start = content_disposition.find("''", filename_start); + if(filename_start != std::string::npos) + filename_start += 2; } if(filename_start == std::string::npos) { diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index a038f66..32696b6 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1213,7 +1213,7 @@ namespace QuickMedia { if(instance.empty()) { tabs.push_back(Tab{create_body(false, false), std::make_unique<PeertubeInstanceSelectionPage>(this), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); } else { - tabs.push_back(Tab{create_body(false, true), std::make_unique<PeertubeSearchPage>(this, instance), create_search_bar("Search...", 350)}); + tabs.push_back(Tab{create_body(false, true), std::make_unique<PeertubeSearchPage>(this, instance), create_search_bar("Search...", 500)}); } } else if(strcmp(plugin_name, "pornhub") == 0) { check_youtube_dl_installed(plugin_name); @@ -2561,7 +2561,7 @@ namespace QuickMedia { } void Program::video_page_download_video(const std::string &url, sf::WindowHandle video_player_window) { - bool separate_audio_option = url_should_download_with_youtube_dl(url);; + bool separate_audio_option = url_should_download_with_youtube_dl(url); std::string video_id; separate_audio_option |= youtube_url_extract_id(url, video_id); @@ -3042,7 +3042,7 @@ namespace QuickMedia { } else if(pressed_keysym == XK_f && pressing_ctrl) { window_set_fullscreen(disp, window.getSystemHandle(), WindowFullscreenState::TOGGLE); } else if(pressed_keysym == XK_s && pressing_ctrl) { - video_page_download_video(video_page->get_url(), video_player_window); + video_page_download_video(video_page->get_download_url(get_largest_monitor_height(disp)), video_player_window); } else if(pressed_keysym == XK_F5) { double resume_start_time = 0.0; video_player->get_time_in_file(&resume_start_time); diff --git a/src/plugins/Peertube.cpp b/src/plugins/Peertube.cpp index dacd2d0..2b2d654 100644 --- a/src/plugins/Peertube.cpp +++ b/src/plugins/Peertube.cpp @@ -15,7 +15,7 @@ namespace QuickMedia { } PluginResult PeertubeInstanceSelectionPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) { - result_tabs.push_back(Tab{create_body(false, true), std::make_unique<PeertubeSearchPage>(program, url), create_search_bar("Search...", 350)}); + result_tabs.push_back(Tab{create_body(false, true), std::make_unique<PeertubeSearchPage>(program, url), create_search_bar("Search...", 500)}); return PluginResult::OK; } @@ -318,6 +318,12 @@ namespace QuickMedia { return url.substr(dot_index); } + std::string PeertubeVideoPage::get_download_url(int max_height) { + bool has_embedded_audio; + std::string ext; + return get_video_url(max_height, has_embedded_audio, ext); + } + std::string PeertubeVideoPage::get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) { has_embedded_audio = true; |