Skip to content

Commit

Permalink
move check_config_sanity()
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsumoto-ren committed Oct 13, 2020
1 parent 05442a9 commit cd6f93a
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions subs2srs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 == ''
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit cd6f93a

Please sign in to comment.