diff options
| author | navewindre <boneyaard@gmail.com> | 2025-04-05 03:00:29 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2025-04-05 03:00:29 +0200 |
| commit | d6c4365b8de32b621ac46074a9b69908b95686c0 (patch) | |
| tree | 495cb5b1aa7e68ab6ec07fa5fb09904a8c7e47e7 /config/mpv/scripts/subs2srsa/subtitles/subtitle.lua | |
| parent | b24463f3d045783b8f4e72926054d53b908e150f (diff) | |
a
Diffstat (limited to 'config/mpv/scripts/subs2srsa/subtitles/subtitle.lua')
| -rw-r--r-- | config/mpv/scripts/subs2srsa/subtitles/subtitle.lua | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/config/mpv/scripts/subs2srsa/subtitles/subtitle.lua b/config/mpv/scripts/subs2srsa/subtitles/subtitle.lua deleted file mode 100644 index 4e8df41..0000000 --- a/config/mpv/scripts/subs2srsa/subtitles/subtitle.lua +++ /dev/null @@ -1,56 +0,0 @@ ---[[ -Copyright: Ren Tatsumoto and contributors -License: GNU GPL, version 3 or later; http://www.gnu.org/licenses/gpl.html - -Subtitle class provides methods for storing and comparing subtitle lines. -]] - -local mp = require('mp') - -local Subtitle = { - ['text'] = '', - ['secondary'] = '', - ['start'] = -1, - ['end'] = -1, -} - -function Subtitle:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - -function Subtitle:now(secondary) - local prefix = secondary and "secondary-" or "" - local this = self:new { - ['text'] = mp.get_property(prefix .. "sub-text"), - ['start'] = mp.get_property_number(prefix .. "sub-start"), - ['end'] = mp.get_property_number(prefix .. "sub-end"), - } - if this:is_valid() then - return this:delay(mp.get_property_native("sub-delay") - mp.get_property_native("audio-delay")) - else - return nil - end -end - -function Subtitle:delay(delay) - self['start'] = self['start'] + delay - self['end'] = self['end'] + delay - return self -end - -function Subtitle:is_valid() - return self['start'] and self['end'] and self['start'] >= 0 and self['end'] > self['start'] -end - -Subtitle.__eq = function(lhs, rhs) - return lhs['text'] == rhs['text'] -end - -Subtitle.__lt = function(lhs, rhs) - return lhs['start'] < rhs['start'] -end - -return Subtitle |
