Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support property-expansion for command #21

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

natural-harmonia-gropius
Copy link
Owner

@natural-harmonia-gropius natural-harmonia-gropius commented Nov 16, 2022

Syntax:
property-expansion

Example:

input.conf

set output TRC to be the same as input.

set target-trc ${video-params/gamma}

ternary operators like.

set target-trc ${?video-params/gamma==pq:hlg}${!video-params/gamma==pq:bt.1886}

evafast like speedup.

SPACE           cycle pause                                                                 #@click
SPACE           no-osd set speed 1; set pause no                                            #@press
SPACE           ignore                                                                      #@release
SPACE           no-osd add speed ${?speed==4.00:0}${!speed==4.00:0.1}; show-text ${speed}   #@repeat

TODO:

  • MPV parse the input.conf on startup and shows an error.
    image

  • Injection via ";" in the string.
    Split commands by ";" and compare the array length of raw_cmd and expanded. This is probably safe enough.

> filename="example; set unsafe true; play another.mp4"
> set title ${title}
> set title example; set unsafe true; play another.mp4

@zhongfly
Copy link

zhongfly commented Nov 20, 2022

第二点:
command_invert里用分号分隔也会有类似问题,命令是set title "example; 6666; 7777"就会分割错误变成{'set title "example','666','777"'}处理第2,3个元素时local property = subs[prefix == "" and 2 or 3]应该就会报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants