mpv: sane-cast: fix crash due to missing table.concat function

This commit is contained in:
2024-04-21 00:24:46 +00:00
parent 4dfee58d09
commit 0625bfdd10
3 changed files with 61 additions and 50 deletions

View File

@@ -137,7 +137,14 @@ let
in in
{ {
sane.programs.mpv = { sane.programs.mpv = {
packageUnwrapped = pkgs.wrapMpv (mpv-unwrapped.override { lua = pkgs.luajit; }) { packageUnwrapped = pkgs.wrapMpv
(mpv-unwrapped.override rec {
# N.B.: populating `self` to `luajit` is necessary for the resulting `lua.withPackages` function to preserve my override.
# i use enable52Compat in order to get `table.unpack`.
# i think using `luajit` here instead of `lua` is optional, just i get better perf with it :)
lua = pkgs.luajit.override { enable52Compat = true; self = lua; };
})
{
scripts = [ scripts = [
pkgs.mpvScripts.mpris pkgs.mpvScripts.mpris
pkgs.mpvScripts.mpv-playlistmanager pkgs.mpvScripts.mpv-playlistmanager
@@ -205,7 +212,7 @@ in
# for `watch_later` # for `watch_later`
".local/state/mpv" ".local/state/mpv"
]; ];
fs.".config/mpv/scripts/sane-cast/main.lua".symlink.target = ./sane-cast-main.lua; fs.".config/mpv/scripts/sane-cast/main.lua".symlink.target = ./sane-cast/main.lua;
fs.".config/mpv/scripts/sane-sysvol/main.lua".symlink.target = ./sane-sysvol/main.lua; fs.".config/mpv/scripts/sane-sysvol/main.lua".symlink.target = ./sane-sysvol/main.lua;
fs.".config/mpv/scripts/sane-sysvol/non_blocking_popen.lua".symlink.target = ./sane-sysvol/non_blocking_popen.lua; fs.".config/mpv/scripts/sane-sysvol/non_blocking_popen.lua".symlink.target = ./sane-sysvol/non_blocking_popen.lua;
fs.".config/mpv/input.conf".symlink.target = ./input.conf; fs.".config/mpv/input.conf".symlink.target = ./input.conf;

View File

@@ -33,7 +33,7 @@ ctrl+s async screenshot #! Utils > Screenshot
alt+i script-binding uosc/keybinds #! Utils > Key bindings alt+i script-binding uosc/keybinds #! Utils > Key bindings
O script-binding uosc/show-in-directory #! Utils > Show in directory O script-binding uosc/show-in-directory #! Utils > Show in directory
# script-binding uosc/open-config-directory #! Utils > Open config directory # script-binding uosc/open-config-directory #! Utils > Open config directory
ctrl+r script-binding sane-cast/blast #! Audiocast ctrl+r script-binding sane_cast/blast #! Audiocast
ctrl+t script-binding sane-cast/go2tv-video #! Cast ctrl+t script-binding sane_cast/go2tv-video #! Cast
# script-binding sane-cast/go2tv-stream #! Cast (...) > Stream # script-binding sane_cast/go2tv-stream #! Cast (...) > Stream
# script-binding sane-cast/go2tv-gui #! Cast (...) > GUI # script-binding sane_cast/go2tv-gui #! Cast (...) > GUI

View File

@@ -1,7 +1,11 @@
msg = require("mp.msg")
msg.trace("load: begin")
function subprocess(in_terminal, args) function subprocess(in_terminal, args)
if in_terminal then if in_terminal then
args = { "xdg-terminal-exec", table.unpack(args) } args = { "xdg-terminal-exec", table.unpack(args) }
end end
msg.info(table.concat(args, " "))
mp.command_native({ mp.command_native({
name = "subprocess", name = "subprocess",
args = args, args = args,
@@ -20,15 +24,15 @@ function invoke_go2tv(in_terminal, args)
end end
function invoke_go2tv_on_open_file(mode) function invoke_go2tv_on_open_file(mode)
local path = mp.get_property("stream-open-filename"); msg.trace("invoke_go2tv_on_open_file")
return invoke_go2tv(true, { mode, path }) local path = mp.get_property("stream-open-filename")
msg.trace("path:", path)
invoke_go2tv(true, { mode, path })
end end
mp.add_key_binding(nil, "blast", function() subprocess(false, { "blast-to-default" }) end) mp.add_key_binding(nil, "blast", function() subprocess(false, { "blast-to-default" }) end)
mp.add_key_binding(nil, 'go2tv-gui', function() invoke_go2tv(false, {}) end) mp.add_key_binding(nil, "go2tv-gui", function() invoke_go2tv(false, {}) end)
mp.add_key_binding(nil, 'go2tv-video', function() invoke_go2tv_on_open_file("-v") end) mp.add_key_binding(nil, "go2tv-video", function() invoke_go2tv_on_open_file("-v") end)
mp.add_key_binding(nil, 'go2tv-stream', function() invoke_go2tv_on_open_file("-s") end) mp.add_key_binding(nil, "go2tv-stream", function() invoke_go2tv_on_open_file("-s") end)
-- uncomment for debugging: msg.trace("load: complete")
-- if mpv fails to eval this script (e.g. syntax error), then it will fail to quit on launch
-- mp.command('quit')