aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-07 23:20:50 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-07 23:20:50 +0100
commit1c1d113d987e76fc3619302902d3d101590c7f38 (patch)
treea6826bddb4ad9ac612b1fa300a7a5b863a7e8a96
parent00436ad621b8cb35696466e68097bc0d56f22fdf (diff)
Fix timestamp in copying of url for videos
-rw-r--r--src/QuickMedia.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 3867237..7c9b348 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1607,6 +1607,15 @@ namespace QuickMedia {
return TaskResult::TRUE;
}
+ static bool video_url_supports_timestamp(const std::string &url) {
+ std::string dummy_id;
+ if(youtube_url_extract_id(url, dummy_id))
+ return true;
+ if(url.find("pornhub.com/view_video.php") != std::string::npos)
+ return true;
+ return false;
+ }
+
#define CLEANMASK(mask) ((mask) & (ShiftMask|ControlMask|Mod1Mask|Mod4Mask|Mod5Mask))
void Program::video_content_page(VideoPage *video_page, std::string video_url, std::string video_title, bool download_if_streaming_fails) {
@@ -1787,14 +1796,12 @@ namespace QuickMedia {
sf::Clock cursor_hide_timer;
bool is_youtube = strcmp(plugin_name, "youtube") == 0;
- bool is_pornhub = strcmp(plugin_name, "pornhub") == 0;
- bool supports_url_timestamp = is_youtube || is_pornhub;
- auto save_video_url_to_clipboard = [&video_url_is_local, &video_url, &video_player_window, &video_player, &supports_url_timestamp]() {
+ auto save_video_url_to_clipboard = [&video_url_is_local, &video_url, &video_player_window, &video_player]() {
if(!video_player_window || video_url_is_local)
return;
- if(supports_url_timestamp) {
+ if(video_url_supports_timestamp(video_url)) {
// TODO: Remove timestamp (&t= or ?t=) from video_url
double time_in_file;
if(video_player->get_time_in_file(&time_in_file) != VideoPlayer::Error::OK)