Endilll / vapoursynth-preview

Preview for VapourSynth scripts
Apache License 2.0
69 stars 21 forks source link

Add support for extra frameprops in filenames #28

Closed RivenSkaye closed 3 years ago

RivenSkaye commented 3 years ago

This allows users to get any frameprops set by filters and functions from *func scripts. For example VFM's VFMMatch or VFMSceneChange, or PlaneStatsDiff additions. Usage is fairly simple, it adds a parsing step to the template to process placeholders in the form of {prop:propname}, where propname must be an exact match to what is registered in the frameprops. If propname doesn't exist, the placeholder will be substituted with no- prefixed to the given value for propname.

It also accepts underscores as an undocumented feature because keyword arguments are not allowed to contain characters like a colon (:), so it silently replaces prop: with prop_

Endilll commented 3 years ago

I'm not a fan of inventing new syntax, to be honest. Is this any better than just adding props to the substitutions dict? Name collisions with predefined placeholders could be a reason, but I don't think this would be an issue in practice since props themselves live in a global namespace, which encourage names to be quite specific.

RivenSkaye commented 3 years ago

This allows for users to select any frameprops they'd like. I could change it to check if the substitution names exist in the dict already instead so the prop: prefix can be dropped. The main goal here is to allow selecting frameprops other than the reserved ones since everything can add to the dict at any time, making the amount of possible frameprops virtually limitless