commit 55dc4bb
Michael Forney
·
2026-04-18 23:56:17 +0000 UTC
parent 9c78153
mpv: Fix scripts for lua 5.5
2 files changed,
+74,
-1
+73,
-0
1@@ -0,0 +1,73 @@
2+From 9bb8684e0aed0aad524212a7e44869305abe7b42 Mon Sep 17 00:00:00 2001
3+From: Michael Forney <mforney@mforney.org>
4+Date: Sat, 18 Apr 2026 16:37:54 -0700
5+Subject: [PATCH] Support lua 5.5
6+
7+---
8+ player/lua/defaults.lua | 1 +
9+ player/lua/options.lua | 3 ++-
10+ player/lua/stats.lua | 1 +
11+ player/lua/ytdl_hook.lua | 2 +-
12+ 4 files changed, 5 insertions(+), 2 deletions(-)
13+
14+diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
15+index baa3a2461e..0e52f9991f 100644
16+--- a/player/lua/defaults.lua
17++++ b/player/lua/defaults.lua
18+@@ -787,6 +787,7 @@ function mp_utils.subprocess(t)
19+ cmd.name = "subprocess"
20+ cmd.capture_stdout = true
21+ for k, v in pairs(t) do
22++ local k = k
23+ if k == "cancellable" then
24+ k = "playback_only"
25+ elseif k == "max_size" then
26+diff --git a/player/lua/options.lua b/player/lua/options.lua
27+index b05b73427b..7f2a062868 100644
28+--- a/player/lua/options.lua
29++++ b/player/lua/options.lua
30+@@ -69,6 +69,7 @@ local function read_options(options, identifier, on_update)
31+ msg.verbose("Opened config file " .. conffilename .. ".")
32+ local linecounter = 1
33+ for line in f:lines() do
34++ local line = line
35+ if line:sub(#line) == "\r" then
36+ line = line:sub(1, #line - 1)
37+ end
38+@@ -111,7 +112,7 @@ local function read_options(options, identifier, on_update)
39+ local function parse_opts(full, options)
40+ for key, val in pairs(full) do
41+ if string.find(key, prefix, 1, true) == 1 then
42+- key = string.sub(key, string.len(prefix)+1)
43++ local key = string.sub(key, string.len(prefix)+1)
44+
45+ -- match found values with defaults
46+ if option_types[key] == nil then
47+diff --git a/player/lua/stats.lua b/player/lua/stats.lua
48+index 3d093c7e2e..6b4319a9bd 100644
49+--- a/player/lua/stats.lua
50++++ b/player/lua/stats.lua
51+@@ -443,6 +443,7 @@ local function get_kbinfo_lines()
52+ bind.subject = cmd_subject(bind.cmd)
53+ if bind.subject ~= "ignore" then
54+ ordered[#ordered+1] = bind
55++ local _
56+ _,_, bind.mods = bind.key:find("(.*)%+.")
57+ _, bind.mods_count = bind.key:gsub("%+.", "")
58+ if bind.key:len() > kspaces:len() then
59+diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
60+index 3161da6194..279ae53ae6 100644
61+--- a/player/lua/ytdl_hook.lua
62++++ b/player/lua/ytdl_hook.lua
63+@@ -152,7 +152,7 @@ local function parse_cookies(cookies_line)
64+ local cookies = {}
65+ local cookie = {}
66+ for stem in cookies_line:gmatch('[^;]+') do
67+- stem = stem:gsub("^%s*(.-)%s*$", "%1")
68++ local stem = stem:gsub("^%s*(.-)%s*$", "%1")
69+ local name, value = stem:match('^(.-)=(.+)$')
70+ if name and name ~= "" and value then
71+ local cmp_name = name:lower()
72+--
73+2.49.0
74+
+1,
-1
1@@ -1 +1 @@
2-0.38.0 r0
3+0.38.0 r1