Commit: cd6f93a2e2d372d027d2e7ab8b71b7a086c761bc
Parent: 05442a983b2e6ac08dae80a4ddc6cb52f7dbb9bb
Author: Ren Tatsumoto
Date: Tue, 13 Oct 2020 19:09:34 +0300
move check_config_sanity()
Diffstat:
| M | subs2srs.lua | | | 55 | ++++++++++++++++++++++++++++--------------------------- |
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git 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