mpv icon indicating copy to clipboard operation
mpv copied to clipboard

The correct way? property expansion of ab-loop-a as command seek arguments

Open hihihippp opened this issue 2 years ago • 1 comments

at #10340 ab-loop-a and ab-loop-b can be setted as following a set ab-loop-a ${=time-pos} b set ab-loop-b ${=time-pos} l set ab-loop-a no; set ab-loop-b no

I want to set b as following: b set ab-loop-b ${=time-pos} ; seek ${=ab-loop-a} absolute

but I got error: [input] Option seek: invalid time: '${=ab-loop-a}' [input] Command seek: argument 1 can't be parsed: option parameter could not be parsed. [input] Command was defined at /home/osboxes/.config/mpv/input.conf:3. [input] Invalid command for key binding 'b': 'set ab-loop-b ${=time-pos}; seek ${=ab-loop-a} absolute'

I have tested: add the follwoing line to input.comf: s show-text ${=ab-loop-a} the time of ab-loop-a show as expected.

my question is: how to make b set ab-loop-b ${=time-pos} ; seek ${=ab-loop-a} absolute works?

hihihippp avatar Jul 08 '22 02:07 hihihippp

All string arguments to input commands as well as certain options (like --term-playing-msg) are subject to property expansion. Note that property expansion does not work in places where e.g. numeric parameters are expected.

Use lua script instead.

mp.add_key_binding("F5", "setB_seekA",
	function()
		mp.commandv("set", "ab-loop-b", mp.get_property_number("time-pos"))
		mp.commandv("seek", mp.get_property_number("ab-loop-a"), "absolute")
	end)

hooke007 avatar Aug 22 '22 10:08 hooke007