aboutsummaryrefslogtreecommitdiff
path: root/src/VideoPlayer.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-06-14 21:51:42 +0200
committerdec05eba <dec05eba@protonmail.com>2025-06-14 21:51:42 +0200
commit52f8dc5d05f5e34b0a3cf4bb4e4fe607f06965c5 (patch)
tree338a4a83685e0f0c7805ef3a884bec8274949f93 /src/VideoPlayer.cpp
parenta3843702b93513052e1e167d52f232b5a5301bd0 (diff)
Better G key behavior in matrix, add ctrl+g for encrypt reply, load mpris from system path if available for videos
Diffstat (limited to 'src/VideoPlayer.cpp')
-rw-r--r--src/VideoPlayer.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp
index da92bf7..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
@@ -251,18 +250,33 @@ 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;
@@ -271,9 +285,11 @@ namespace QuickMedia {
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())