diff options
Diffstat (limited to 'src/VideoPlayer.cpp')
-rw-r--r-- | src/VideoPlayer.cpp | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 3aa4eca..ea18289 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -177,7 +177,6 @@ namespace QuickMedia { const std::string config_dir = "--config-dir=" + startup_args.resource_root + "mpv"; const std::string input_conf_file = "--input-conf=" + startup_args.resource_root + "mpv/input.conf"; - const std::string ytdl_hook_file = "--scripts=" + startup_args.resource_root + "mpv/scripts/ytdl_hook.lua"; std::vector<const char*> args; // TODO: Resume playback if the last video played matches the first video played next time QuickMedia is launched @@ -218,7 +217,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"); } @@ -251,27 +250,51 @@ namespace QuickMedia { if(!startup_args.referer.empty()) args.push_back(referer_arg.c_str()); - std::string mpris_arg; - Path mpris_path = get_config_dir_xdg().join("mpv").join("scripts").join("mpris.so"); - if(get_file_type(mpris_path) == FileType::REGULAR) - mpris_arg = "--scripts=" + mpris_path.data; + std::string scripts; + std::string scripts_arg; + const Path mpris_path = get_config_dir_xdg().join("mpv").join("scripts").join("mpris.so"); + if(get_file_type(mpris_path) == FileType::REGULAR) { + if(!scripts.empty()) + scripts += ":"; + scripts += mpris_path.data; + } + + const Path mpris_system_path = "/etc/mpv/scripts/mpris.so"; + if(get_file_type(mpris_system_path) == FileType::REGULAR) { + if(!scripts.empty()) + scripts += ":"; + scripts += mpris_system_path.data; + } + + std::string profile_arg; if(startup_args.use_system_mpv_config) { + if(!scripts.empty()) + scripts += ":"; + scripts += startup_args.resource_root + "mpv/scripts/ytdl_hook.lua"; + args.push_back("--config=yes"); args.push_back("--load-scripts=yes"); args.push_back("--osc=yes"); args.push_back(input_conf_file.c_str()); - args.push_back(ytdl_hook_file.c_str()); + + if(!startup_args.system_mpv_profile.empty()) + profile_arg = "--profile=" + startup_args.system_mpv_profile; } else { args.insert(args.end(), { config_dir.c_str(), "--config=yes" }); + } - if(!mpris_arg.empty()) - args.push_back(mpris_arg.c_str()); + if(!scripts.empty()) { + scripts_arg = "--scripts=" + scripts; + args.push_back(scripts_arg.c_str()); } + if(!profile_arg.empty()) + args.push_back(profile_arg.c_str()); + std::string force_media_title_arg; if(!startup_args.title.empty()) { force_media_title_arg = "--force-media-title=" + startup_args.title; |