osc: add validation for string user options

This commit is contained in:
ahoka 2014-11-07 23:05:07 -06:00 committed by wm4
parent 6de303c339
commit e7b45b1efa
1 changed files with 16 additions and 0 deletions

View File

@ -1230,6 +1230,20 @@ layouts["topbar"] = function()
lo.style = osc_styles.vidtitle
end
-- Validate string type user options
function validate_user_opts()
if layouts[user_opts.layout] == nil then
msg.warn("Invalid setting \""..user_opts.layout.."\" for layout")
user_opts.layout = "box"
end
if user_opts.seekbarstyle ~= "slider" and
user_opts.seekbarstyle ~= "bar" then
msg.warn("Invalid setting \""..user_opts.seekbarstyle.."\" for seekbarstyle")
user_opts.seekbarstyle = "slider"
end
end
-- OSC INIT
function osc_init()
@ -1849,6 +1863,8 @@ function enable_osc(enable)
end
end
validate_user_opts()
mp.register_event("tick", tick)
mp.register_event("start-file", request_init)
mp.register_event("tracks-changed", request_init)