Closed zaeboba closed 1 month ago
That would be nice, but the way it's implemented in mpv, loop-playlist
and loop-file
are two different properties, so there's no way to combine them into one button in our controls config.
That would be nice, but the way it's implemented in mpv,
loop-playlist
andloop-file
are two different properties, so there's no way to combine them into one button in our controls config.
if I have a lua script to switch these modes, can I make a button with display as well? even with this I can't figure it out to be honest, and the documentation doesn't help me in any way (it's very complicated, at least for me).
function cycle_repeat_mode()
local loop_file = mp.get_property("loop-file")
local loop_playlist = mp.get_property("loop-playlist")
mp.msg.info("Current loop-file: " .. loop_file)
mp.msg.info("Current loop-playlist: " .. loop_playlist)
if loop_file == "inf" then
mp.set_property("loop-file", "no")
mp.set_property("loop-playlist", "inf")
mp.osd_message("Повтор плейлиста включен")
mp.msg.info("Switched to loop-playlist")
elseif loop_playlist == "inf" then
mp.set_property("loop-playlist", "no")
mp.osd_message("Повтор отключен")
mp.msg.info("Switched to no-repeat")
else
mp.set_property("loop-file", "inf")
mp.osd_message("Повтор файла включен")
mp.msg.info("Switched to loop-file")
end
end
mp.register_script_message("cycle-repeat-mode", cycle_repeat_mode)
loop-playlist and loop-file are two different properties
Yes and it's reasonable in a player. loop-file
and loop-playlist
enabled at same time is also a common use case (Play every item X times). When you play the last item, loop-playlist
decides what next
would do.
There's currently no way for a script to change a control button icon. But this should be an easy feature to add. I'll do it after #936 is merged.
A description of how I imagine it working so I wont forget:
On script's side:
-- Add or update a custom script managed button
mp.commandv('script-message-to', 'uosc', 'set-button', 'button-name', utils.format_json({
icon = 'icon_name',
active = true,
badge = '0',
tooltip = 'Button tooltip',
command = 'command to send on click',
}))
And add into controls in uosc.conf
with:
controls=button:button-name
I fight over this question for the third day and already managed to break my brain, nothing works, only everything breaks down I want to combine the two buttons into one button, making three modes. repeat off (repeat) - playlist repeat enabled (repeat_on) - single file repeat enabled (repeat_one_on) what's in parentheses is a google font.