Skip to content

Commit

Permalink
display secondary subtitle in selected text
Browse files Browse the repository at this point in the history
Co-authored-by: Ren Tatsumoto <tatsu@autistici.org>
  • Loading branch information
pinntokuru and tatsumoto-ren authored Jan 29, 2024
1 parent 551a817 commit 85affbc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion subs2srs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,18 @@ end
function menu:print_selection(osd)
if subs_observer.is_appending() and config.show_selected_text then
osd:new_layer():size(config.menu_font_size):font(config.menu_font_name):align(6)
osd:submenu("Selected text"):newline()
osd:submenu("Primary text"):newline()
for _, s in ipairs(subs_observer.recorded_subs()) do
osd:text(escape_for_osd(s['text'])):newline()
end
if not h.is_empty(config.secondary_field) then
-- If the user wants to add secondary subs to Anki,
-- it's okay to print them on the screen.
osd:submenu("Secondary text"):newline()
for _, s in ipairs(subs_observer.recorded_secondary_subs()) do
osd:text(escape_for_osd(s['text'])):newline()
end
end
end
end

Expand Down
4 changes: 4 additions & 0 deletions subtitles/observer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ self.recorded_subs = function()
return dialogs.get_subs_list()
end

self.recorded_secondary_subs = function()
return secondary_dialogs.get_subs_list()
end

self.autocopy_status_str = function()
return string.format(
"%s (%s)",
Expand Down

0 comments on commit 85affbc

Please sign in to comment.