Commit: 53d0806122b9748def649d8344532c6f8afeee6b
Parent: 189595dfccd87cb205c1a582dcc720c42f15f03e
Author: Ren Tatsumoto
Date: Thu, 27 Aug 2020 11:15:12 +0300
config
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
@@ -45,6 +45,7 @@ $ cd ~/.config/mpv/scripts/subs2srs && git pull
Configuration file is located at ```~/.config/mpv/script-opts/subs2srs.conf```
and should be created by the user. If a parameter is not specified
in the config file, the default value will be used.
+mpv doesn't tolerate spaces before and after `=`.
Example configuration file:
```
diff --git a/subs2srs.lua b/subs2srs.lua
@@ -43,8 +43,12 @@ local ankiconnect
------------------------------------------------------------
-- utility functions
+function string:endswith(suffix)
+ return self:match(string.format('%s$', suffix))
+end
+
local function check_config_sanity()
- if config.collection_path[-1] ~= '/' then
+ if not config.collection_path:endswith('/') then
-- The user forgot to add a slash at the end of the collection path
config.collection_path = config.collection_path .. '/'
end
@@ -56,7 +60,7 @@ local function check_config_sanity()
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_width = -2
config.snapshot_height = 200
mp.osd_message("`snapshot_width` and `snapshot_height` can't be both less than 1.", 5)
end