mpv2oboeru

mpv helpers to create flashcards from movies and TV shows
git clone anongit@rnpnr.xyz:mpv2oboeru.git
Log | Files | Refs | Feed | README | LICENSE

Commit: aff73462f026816a0f19bf9f5218b8a844a0f8b6
Parent: e829a87b2317162b28a98adaaba731ac6382519d
Author: Ren Tatsumoto
Date:   Tue,  4 Aug 2020 07:57:34 +0300

don't allow insane image dimensions or invalid quality

Diffstat:
Msubs2srs.lua | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/subs2srs.lua b/subs2srs.lua @@ -15,7 +15,7 @@ -- * ankiconnect config = { - collection_path = os.getenv("HOME") .. '/.local/share/Anki2/' .. os.getenv("USER") .. '/collection.media/', -- trailing slash is necessary + collection_path = os.getenv("HOME") .. '/.local/share/Anki2/' .. os.getenv("USER") .. '/collection.media/', autoclip = false, -- copy subs to the clipboard or not nuke_spaces = true, -- remove all spaces or not human_readable_time = true, -- use seconds if false @@ -48,11 +48,18 @@ config.check_sanity = function() 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 mp.osd_message("`snapshot_width` and `snapshot_height` can't be both less than 1.", 5) end + + if config.snapshot_quality < 0 or config.snapshot_quality > 100 then + config.snapshot_quality = 5 + end end function split_str(str)