ekisu / mpv-webm

Simple WebM maker for mpv, with no external dependencies.
MIT License
555 stars 32 forks source link

[Suggestion] config file documentation #102

Closed Soundtoxin closed 3 years ago

Soundtoxin commented 3 years ago

I don't know if this is possible or not already, but I would like to configure options for mpv-webm in a separate file, so that updating the script doesn't wipe out my settings. I like to set a specific output directory and filesize limit. Currently I just edit the lua file directly.

ekisu commented 3 years ago

It should be possible to place settings under script-opts/webm.conf already, like other scripts (although it's undocumented, and I never really used/tested it)

Soundtoxin commented 3 years ago

Some documentation or examples would be much appreciated!

I tried putting the following in ~/.config/mpv/script-opts/webm.conf

target_filesize = 4100
output_directory = [[~/mpvwebm]]

Basically just copy/pasted from the .lua file (although I took the , off the end of the output_directory line, wasn't sure if it was needed), and when I opened a new mpv instance and pressed W, then went into the options, the target_filesize was still the one set in the lua file.

I see in the mpv console the following:

[webm] script-opts/webm.conf:1 unknown key target_filesize , ignoring
[webm] script-opts/webm.conf:2 unknown key output_directory , ignoring

I noticed after trying this that the options I was concerned with were indented and inside of local options (also realized why the commas were there), so I rewrote webm.conf to look like this:

local options = {
target_filesize = 4100,
output_directory = [[~/mpvwebm]]
}

Still no luck, now the errors are

[webm] script-opts/webm.conf:1 unknown key local options , ignoring
[webm] script-opts/webm.conf:2 unknown key target_filesize , ignoring
[webm] script-opts/webm.conf:3 unknown key output_directory , ignoring
Soundtoxin commented 3 years ago

Okay, I figured it out just now, actually. It helped looking closer at some other things in script-opts. (I checked out contact_sheet.conf) The following works. Basically, no spaces or commas was the trick.

target_filesize=4100
output_directory=[[~/mpvwebm]]

Feel free to use these bits as an example in the readme or something!

po5 commented 3 years ago

You don't need [[ ]] around the path and I'm surprised that even works at all. Look through people's dotfiles repos for more examples. I guess including a webm.conf at the base of this repo with the default config wouldn't take much work.

nick-s-b commented 3 years ago

A quick tip... instead of using true/false for Booleans, like in Lua and MoonScript, use yes/no in the webm.conf file instead.