diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-06-11 23:49:59 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-06-11 23:49:59 +0200 |
commit | a3843702b93513052e1e167d52f232b5a5301bd0 (patch) | |
tree | a1393c0491a7d83e7397120a9f5fc8ba7ec75020 /src | |
parent | fd20b4fba2d9a3b5d6be28208dc9f2b58f9cd3ff (diff) |
Fix youtube download
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 5 | ||||
-rw-r--r-- | src/Utils.cpp | 15 | ||||
-rw-r--r-- | src/VideoPlayer.cpp | 2 |
3 files changed, 9 insertions, 13 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 037d218..8cdc874 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3102,7 +3102,10 @@ namespace QuickMedia { } static bool url_should_download_with_youtube_dl(const std::string &url) { - return url.find("pornhub.com") != std::string::npos + return url.find("youtube.com") != std::string::npos + || url.find("youtu.be") != std::string::npos + || url.find("googlevideo.com") != std::string::npos + || url.find("pornhub.com") != std::string::npos || url.find("xhamster.com") != std::string::npos || url.find("spankbang.com") != std::string::npos // TODO: Remove when youtube-dl is no longer required to download soundcloud music diff --git a/src/Utils.cpp b/src/Utils.cpp index ca153ab..e6628d1 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -2,13 +2,11 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <locale.h> +#include <X11/Xlib.h> namespace QuickMedia { static bool qm_enable_touch = false; static bool qm_enable_touch_set = false; - static bool wayland_display_set = false; - static const char *wayland_display = nullptr; void show_virtual_keyboard() { if(!is_touch_enabled()) @@ -38,14 +36,9 @@ namespace QuickMedia { return qm_enable_touch; } - // TODO: Find a better way to detect this. This will return true on ubuntu when running gnome in x11 mode - bool is_running_wayland() { - if(wayland_display_set) - return wayland_display; - - wayland_display = getenv("WAYLAND_DISPLAY"); - wayland_display_set = true; - return wayland_display; + bool is_running_wayland(void *dpy) { + int opcode, event, error; + return XQueryExtension((Display*)dpy, "XWAYLAND", &opcode, &event, &error); } time_t iso_utc_to_unix_time(const char *time_str) { diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 0fac7aa..da92bf7 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -218,7 +218,7 @@ namespace QuickMedia { args.push_back("--resume-playback=no"); } - if(is_running_wayland()) { + if(is_running_wayland(display)) { args.push_back("--gpu-context=x11egl"); fprintf(stderr, "Wayland detected. Launching mpv in x11egl mode\n"); } |