From cd6f93a2e2d372d027d2e7ab8b71b7a086c761bc Mon Sep 17 00:00:00 2001 From: Ren Tatsumoto Date: Tue, 13 Oct 2020 19:09:34 +0300 Subject: [PATCH] move check_config_sanity() --- subs2srs.lua | 55 ++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/subs2srs.lua b/subs2srs.lua index 3051cdd..8c9e378 100644 --- a/subs2srs.lua +++ b/subs2srs.lua @@ -91,33 +91,6 @@ local function notify(message, level, duration) mp.osd_message(message, duration) end -local function check_config_sanity() - if config.snapshot_width < 1 then - config.snapshot_width = -2 - end - - if config.snapshot_height < 1 then - config.snapshot_height = -2 - end - - if config.snapshot_width > 800 then - config.snapshot_width = 800 - end - - if config.snapshot_height > 800 then - config.snapshot_height = 800 - end - - if config.snapshot_width < 1 and config.snapshot_height < 1 then - config.snapshot_width = -2 - config.snapshot_height = 200 - notify("`snapshot_width` and `snapshot_height` can't be both less than 1.", "warn", 5) - end - - if config.snapshot_quality < 0 or config.snapshot_quality > 100 then - config.snapshot_quality = 5 - end -end local function is_emptystring(str) return str == nil or str == '' @@ -364,6 +337,34 @@ local function join_media_fields(note1, note2) return note1 end +local function check_config_sanity() + if config.snapshot_width < 1 then + config.snapshot_width = -2 + end + + if config.snapshot_height < 1 then + config.snapshot_height = -2 + end + + if config.snapshot_width > 800 then + config.snapshot_width = 800 + end + + if config.snapshot_height > 800 then + config.snapshot_height = 800 + end + + if config.snapshot_width < 1 and config.snapshot_height < 1 then + config.snapshot_width = -2 + config.snapshot_height = 200 + notify("`snapshot_width` and `snapshot_height` can't be both less than 1.", "warn", 5) + end + + if config.snapshot_quality < 0 or config.snapshot_quality > 100 then + config.snapshot_quality = 5 + end +end + ------------------------------------------------------------ -- provides interface for creating audioclips and snapshots