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/sub_list.lua | |
| parent | b24463f3d045783b8f4e72926054d53b908e150f (diff) | |
a
Diffstat (limited to 'config/mpv/scripts/subs2srsa/subtitles/sub_list.lua')
| -rw-r--r-- | config/mpv/scripts/subs2srsa/subtitles/sub_list.lua | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/config/mpv/scripts/subs2srsa/subtitles/sub_list.lua b/config/mpv/scripts/subs2srsa/subtitles/sub_list.lua deleted file mode 100644 index de7e1c2..0000000 --- a/config/mpv/scripts/subs2srsa/subtitles/sub_list.lua +++ /dev/null @@ -1,74 +0,0 @@ ---[[ -Copyright: Ren Tatsumoto and contributors -License: GNU GPL, version 3 or later; http://www.gnu.org/licenses/gpl.html - -Subtitle list remembers selected subtitle lines. -]] - -local h = require('helpers') - -local new_sub_list = function() - local subs_list = {} - - local find_i = function(sub) - for i, v in ipairs(subs_list) do - if sub < v then - return i - end - end - return #subs_list + 1 - end - local get_time = function(position) - local i = position == 'start' and 1 or #subs_list - return subs_list[i][position] - end - local get_text = function() - local speech = {} - for _, sub in ipairs(subs_list) do - table.insert(speech, sub['text']) - end - return table.concat(speech, ' ') - end - local get_n_text = function(sub, n_lines) - local speech = {} - local end_sub = sub - for _, v in ipairs(subs_list) do - if v['start'] - end_sub['end'] >= 20 then - break - end - if v >= sub and #speech < n_lines then - table.insert(speech, v['text']) - end_sub = v - end - end - return table.concat(speech, ' '), end_sub - end - local insert = function(sub) - if sub ~= nil and not h.contains(subs_list, sub) then - table.insert(subs_list, find_i(sub), sub) - return true - end - return false - end - local get_subs_list = function() - local copy = {} - for key, value in pairs(subs_list) do - copy[key] = value - end - return copy - end - return { - get_subs_list = get_subs_list, - get_time = get_time, - get_text = get_text, - get_n_text = get_n_text, - insert = insert, - is_empty = function() - return h.is_empty(subs_list) - end, - } -end - -return { - new = new_sub_list, -} |
