mirror of https://github.com/mpv-player/mpv
osc: use mp.send_commandv
See previous commit. Drop no-osd prefixes, as this is the default for send_commandv anyway. send_command should probably be renamed later.
This commit is contained in:
parent
18930ba7dd
commit
2f6144c74b
|
@ -312,7 +312,7 @@ function set_track(type, next)
|
||||||
new_track_mpv = tracks_osc[type][new_track_osc].id
|
new_track_mpv = tracks_osc[type][new_track_osc].id
|
||||||
end
|
end
|
||||||
|
|
||||||
mp.send_command("no-osd set " .. type .. " " .. new_track_mpv)
|
mp.send_commandv("set", type, new_track_mpv)
|
||||||
|
|
||||||
if (new_track_osc == 0) then
|
if (new_track_osc == 0) then
|
||||||
show_message(nicetypes[type] .. " Track: none")
|
show_message(nicetypes[type] .. " Track: none")
|
||||||
|
@ -755,13 +755,13 @@ function osc_init()
|
||||||
|
|
||||||
-- playlist prev
|
-- playlist prev
|
||||||
local eventresponder = {}
|
local eventresponder = {}
|
||||||
eventresponder.mouse_btn0_up = function () mp.send_command("playlist_prev weak") end
|
eventresponder.mouse_btn0_up = function () mp.send_commandv("playlist_prev", "weak") end
|
||||||
eventresponder["shift+mouse_btn0_up"] = function () show_message(mp.property_get("playlist"), 3) end
|
eventresponder["shift+mouse_btn0_up"] = function () show_message(mp.property_get("playlist"), 3) end
|
||||||
register_button(posX - pos_offsetX, titlerowY, 7, 12, 12, osc_styles.vidtitle, "◀", eventresponder, metainfo)
|
register_button(posX - pos_offsetX, titlerowY, 7, 12, 12, osc_styles.vidtitle, "◀", eventresponder, metainfo)
|
||||||
|
|
||||||
-- playlist next
|
-- playlist next
|
||||||
local eventresponder = {}
|
local eventresponder = {}
|
||||||
eventresponder.mouse_btn0_up = function () mp.send_command("playlist_next weak") end
|
eventresponder.mouse_btn0_up = function () mp.send_commandv("playlist_next", "weak") end
|
||||||
eventresponder["shift+mouse_btn0_up"] = function () show_message(mp.property_get("playlist"), 3) end
|
eventresponder["shift+mouse_btn0_up"] = function () show_message(mp.property_get("playlist"), 3) end
|
||||||
register_button(posX + pos_offsetX, titlerowY, 9, 12, 12, osc_styles.vidtitle, "▶", eventresponder, metainfo)
|
register_button(posX + pos_offsetX, titlerowY, 9, 12, 12, osc_styles.vidtitle, "▶", eventresponder, metainfo)
|
||||||
|
|
||||||
|
@ -781,7 +781,7 @@ function osc_init()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local eventresponder = {}
|
local eventresponder = {}
|
||||||
eventresponder.mouse_btn0_up = function () mp.send_command("no-osd cycle pause") end
|
eventresponder.mouse_btn0_up = function () mp.send_commandv("cycle", "pause") end
|
||||||
register_button(posX, bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, contentF, eventresponder, nil)
|
register_button(posX, bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, contentF, eventresponder, nil)
|
||||||
|
|
||||||
--skipback
|
--skipback
|
||||||
|
@ -789,16 +789,16 @@ function osc_init()
|
||||||
metainfo.softrepeat = true
|
metainfo.softrepeat = true
|
||||||
|
|
||||||
local eventresponder = {}
|
local eventresponder = {}
|
||||||
eventresponder.mouse_btn0_down = function () mp.send_command("no-osd seek -5 relative keyframes") end
|
eventresponder.mouse_btn0_down = function () mp.send_commandv("seek", -5, "relative", "keyframes") end
|
||||||
eventresponder["shift+mouse_btn0_down"] = function () mp.send_command("no-osd frame_back_step") end
|
eventresponder["shift+mouse_btn0_down"] = function () mp.send_commandv("frame_back_step") end
|
||||||
eventresponder.mouse_btn2_down = function () mp.send_command("no-osd seek -30 relative keyframes") end
|
eventresponder.mouse_btn2_down = function () mp.send_commandv("seek", -30, "relative", "keyframes") end
|
||||||
register_button(posX - bigbuttondistance, bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, "\238\128\132", eventresponder, metainfo)
|
register_button(posX - bigbuttondistance, bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, "\238\128\132", eventresponder, metainfo)
|
||||||
|
|
||||||
--skipfrwd
|
--skipfrwd
|
||||||
local eventresponder = {}
|
local eventresponder = {}
|
||||||
eventresponder.mouse_btn0_down = function () mp.send_command("no-osd seek 10 relative keyframes") end
|
eventresponder.mouse_btn0_down = function () mp.send_commandv("seek", 10, "relative", "keyframes") end
|
||||||
eventresponder["shift+mouse_btn0_down"] = function () mp.send_command("no-osd frame_step") end
|
eventresponder["shift+mouse_btn0_down"] = function () mp.send_commandv("frame_step") end
|
||||||
eventresponder.mouse_btn2_down = function () mp.send_command("no-osd seek 60 relative keyframes") end
|
eventresponder.mouse_btn2_down = function () mp.send_commandv("seek", 60, "relative", "keyframes") end
|
||||||
register_button(posX + bigbuttondistance, bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, "\238\128\133", eventresponder, metainfo)
|
register_button(posX + bigbuttondistance, bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, "\238\128\133", eventresponder, metainfo)
|
||||||
|
|
||||||
--chapters
|
--chapters
|
||||||
|
@ -808,13 +808,13 @@ function osc_init()
|
||||||
|
|
||||||
--prev
|
--prev
|
||||||
local eventresponder = {}
|
local eventresponder = {}
|
||||||
eventresponder.mouse_btn0_up = function () mp.send_command("osd-msg add chapter -1") end
|
eventresponder.mouse_btn0_up = function () mp.send_commandv("osd-msg", "add", "chapter", -1) end
|
||||||
eventresponder["shift+mouse_btn0_up"] = function () show_message(mp.property_get("chapter-list"), 3) end
|
eventresponder["shift+mouse_btn0_up"] = function () show_message(mp.property_get("chapter-list"), 3) end
|
||||||
register_button(posX - (bigbuttondistance * 2), bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, "\238\132\132", eventresponder, metainfo)
|
register_button(posX - (bigbuttondistance * 2), bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, "\238\132\132", eventresponder, metainfo)
|
||||||
|
|
||||||
--next
|
--next
|
||||||
local eventresponder = {}
|
local eventresponder = {}
|
||||||
eventresponder.mouse_btn0_up = function () mp.send_command("osd-msg add chapter 1") end
|
eventresponder.mouse_btn0_up = function () mp.send_commandv("osd-msg", "add", "chapter", 1) end
|
||||||
eventresponder["shift+mouse_btn0_up"] = function () show_message(mp.property_get("chapter-list"), 3) end
|
eventresponder["shift+mouse_btn0_up"] = function () show_message(mp.property_get("chapter-list"), 3) end
|
||||||
register_button(posX + (bigbuttondistance * 2), bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, "\238\132\133", eventresponder, metainfo)
|
register_button(posX + (bigbuttondistance * 2), bigbuttonrowY, 5, 40, 40, osc_styles.bigButtons, "\238\132\133", eventresponder, metainfo)
|
||||||
|
|
||||||
|
@ -857,8 +857,8 @@ function osc_init()
|
||||||
ass:append("\238\132\134" .. osc_styles.smallButtonsLlabel .. " " .. aid)
|
ass:append("\238\132\134" .. osc_styles.smallButtonsLlabel .. " " .. aid)
|
||||||
end
|
end
|
||||||
|
|
||||||
eventresponder.mouse_btn0_up = function () mp.send_command("osd-msg add audio 1") end
|
eventresponder.mouse_btn0_up = function () mp.send_commandv("osd-msg", "add", "audio", 1) end
|
||||||
eventresponder.mouse_btn2_up = function () mp.send_command("osd-msg add audio -1") end
|
eventresponder.mouse_btn2_up = function () mp.send_commandv("osd-msg", "add", "audio", -1) end
|
||||||
end
|
end
|
||||||
|
|
||||||
register_button(posX - pos_offsetX, bigbuttonrowY, 1, 70, 18, osc_styles.smallButtonsL, contentF, eventresponder, metainfo)
|
register_button(posX - pos_offsetX, bigbuttonrowY, 1, 70, 18, osc_styles.smallButtonsL, contentF, eventresponder, metainfo)
|
||||||
|
@ -894,8 +894,8 @@ function osc_init()
|
||||||
ass:append("\238\132\135" .. osc_styles.smallButtonsLlabel .. " " .. sid)
|
ass:append("\238\132\135" .. osc_styles.smallButtonsLlabel .. " " .. sid)
|
||||||
end
|
end
|
||||||
|
|
||||||
eventresponder.mouse_btn0_up = function () mp.send_command("osd-msg add sub 1") end
|
eventresponder.mouse_btn0_up = function () mp.send_commandv("osd-msg", "add", "sub", 1) end
|
||||||
eventresponder.mouse_btn2_up = function () mp.send_command("osd-msg add sub -1") end
|
eventresponder.mouse_btn2_up = function () mp.send_commandv("osd-msg", "add", "sub", -1) end
|
||||||
end
|
end
|
||||||
register_button(posX - pos_offsetX, bigbuttonrowY, 7, 70, 18, osc_styles.smallButtonsL, contentF, eventresponder, metainfo)
|
register_button(posX - pos_offsetX, bigbuttonrowY, 7, 70, 18, osc_styles.smallButtonsL, contentF, eventresponder, metainfo)
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ function osc_init()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local eventresponder = {}
|
local eventresponder = {}
|
||||||
eventresponder.mouse_btn0_up = function () mp.send_command("no-osd cycle fullscreen") end
|
eventresponder.mouse_btn0_up = function () mp.send_commandv("cycle", "fullscreen") end
|
||||||
register_button(posX+pos_offsetX, bigbuttonrowY, 6, 25, 25, osc_styles.smallButtonsR, contentF, eventresponder, nil)
|
register_button(posX+pos_offsetX, bigbuttonrowY, 6, 25, 25, osc_styles.smallButtonsR, contentF, eventresponder, nil)
|
||||||
|
|
||||||
|
|
||||||
|
@ -967,7 +967,7 @@ function osc_init()
|
||||||
local seek_to = get_slider_value(element)
|
local seek_to = get_slider_value(element)
|
||||||
-- ignore identical seeks
|
-- ignore identical seeks
|
||||||
if not(state.last_seek == seek_to) then
|
if not(state.last_seek == seek_to) then
|
||||||
mp.send_command(string.format("no-osd seek %f absolute-percent keyframes", seek_to))
|
mp.send_commandv("seek", seek_to, "absolute-percent", "keyframes")
|
||||||
state.last_seek = seek_to
|
state.last_seek = seek_to
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue