Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a "Search and Download" button that does a one-click search, download and load. #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions vlsub.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ local options = {
int_show_help = 'Show help',
int_show_conf = 'Show config',
int_dowload_sel = 'Download selection',
int_search_and_download = 'Search and download',
int_close = 'Close',
int_ok = 'Ok',
int_save = 'Save',
Expand Down Expand Up @@ -380,7 +381,8 @@ function interface_main()
dlg:add_button(lang["int_show_help"], show_help, 1, 7, 1, 1)
dlg:add_button(' '..lang["int_show_conf"]..' ', show_conf, 2, 7, 1, 1)
dlg:add_button(lang["int_dowload_sel"], download_subtitles, 3, 7, 1, 1)
dlg:add_button(lang["int_close"], deactivate, 4, 7, 1, 1)
dlg:add_button(lang["int_search_and_download"], search_and_download, 4, 7, 1, 1)
dlg:add_button(lang["int_close"], deactivate, 5, 7, 1, 1)

assoc_select_conf('language', 'language', openSub.conf.languages, 2, lang["int_all"])
display_subtitles()
Expand Down Expand Up @@ -1475,6 +1477,16 @@ function get_first_sel(list)
return 0
end

function search_and_download()
searchHash()
local item = openSub.itemStore[1]
if item then
--vlc.msg.dbg("+++++++++ "..item.SubFileName)
download_subtitles_by_item(item)
end
return false
end

function download_subtitles()
local index = get_first_sel(input_table["mainlist"])

Expand All @@ -1483,12 +1495,14 @@ function download_subtitles()
return false
end

local item = openSub.itemStore[index]
download_subtitles_by_item(item)
end

function download_subtitles_by_item(item)
openSub.actionLabel = lang["mess_downloading"]

display_subtitles() -- reset selection

local item = openSub.itemStore[index]


if openSub.option.downloadBehaviour == 'manual' then
local link = "<span style='color:#181'>"
link = link.."<b>"..lang["mess_dowload_link"]..":</b>"
Expand Down