mpv: update wrapper to support multiple --script args

This commit is contained in:
WheelsForReals
2025-11-12 19:22:09 -06:00
parent 449f000a7e
commit e4bb290195
4 changed files with 14 additions and 7 deletions
@@ -9,6 +9,7 @@ buildLua (finalAttrs: {
scriptPath = "osc_tethys.lua";
extraScriptsToCopy = [ "mpv_thumbnail_script_server.lua" ];
extraScriptsToLoad = [ "mpv_thumbnail_script_server.lua" ];
src = fetchFromGitHub {
owner = "Zren";
@@ -19,6 +19,7 @@ buildLua rec {
passthru.updateScript = gitUpdater { rev-prefix = "v"; };
extraScriptsToCopy = lib.optional oscSupport "quality-menu-osc.lua";
extraScriptsToLoad = lib.optional oscSupport "quality-menu-osc.lua";
meta = with lib; {
description = "Userscript for MPV that allows you to change youtube video quality (ytdl-format) on the fly";
@@ -24,7 +24,7 @@ buildLua rec {
scriptPath = "mpv_thumbnail_script_client_osc.lua";
extraScriptsToCopy = [ "mpv_thumbnail_script_server.lua" ];
passthru.scriptName = "mpv_thumbnail_script_{client_osc,server}.lua";
extraScriptsToLoad = [ "mpv_thumbnail_script_server.lua" ];
meta = {
description = "Lua script to show preview thumbnails in mpv's OSC seekbar";
+11 -6
View File
@@ -73,12 +73,17 @@ let
# For every script in the `scripts` argument, add the necessary flags to the wrapper
(
script:
[
"--add-flags"
# Here we rely on the existence of the `scriptName` passthru
# attribute of the script derivation from the `scripts`
"--script=${script}/share/mpv/scripts/${script.scriptName}"
]
let
mkScriptArgs = script: scriptName: [
"--add-flags"
"--script=${script}/share/mpv/scripts/${scriptName}"
];
in
# Here we rely on the existence of the `scriptName` passthru
# attribute of the script derivation from the `scripts`
(mkScriptArgs script script.scriptName)
# scripts might need others to be explicitly loaded
++ (map (extraScriptName: mkScriptArgs script extraScriptName) (script.extraScriptsToLoad or [ ]))
# scripts can also set the `extraWrapperArgs` passthru
++ (script.extraWrapperArgs or [ ])
)