diff --git a/vlsub.lua b/vlsub.lua index b70aee6..d1974e4 100644 --- a/vlsub.lua +++ b/vlsub.lua @@ -66,6 +66,7 @@ local options = { int_help = 'Help', int_search_hash = 'Search by hash', int_search_name = 'Search by name', + int_feeling_lucky = 'I\'m feeling lucky', int_title = 'Title', int_season = 'Season (series)', int_episode = 'Episode (series)', @@ -386,7 +387,7 @@ function input_changed() end --[[ Interface data ]]-- - + function interface_main() dlg:add_label(lang["int_default_lang"]..':', 1, 1, 1, 1) input_table['language'] = dlg:add_dropdown(2, 1, 2, 1) @@ -398,6 +399,9 @@ function interface_main() openSub.movie.title or "", 2, 2, 2, 1) dlg:add_button(lang["int_search_name"], searchIMBD, 4, 2, 1, 1) + dlg:add_button(lang["int_feeling_lucky"], + feelingLucky, 4, 3, 1, 1) + dlg:add_label(lang["int_season"]..':', 1, 3, 1, 1) input_table['seasonNumber'] = dlg:add_text_input( openSub.movie.seasonNumber or "", 2, 3, 2, 1) @@ -412,7 +416,7 @@ function interface_main() 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) + lang["int_dowload_sel"], download_subtitle, 3, 7, 1, 1) dlg:add_button( lang["int_close"], deactivate, 4, 7, 1, 1) @@ -1625,6 +1629,11 @@ function searchIMBD() end end +function feelingLucky() + searchHash() + download_subtitle(1) +end + function display_subtitles() local mainlist = input_table["mainlist"] mainlist:clear() @@ -1653,8 +1662,10 @@ function get_first_sel(list) return 0 end -function download_subtitles() - local index = get_first_sel(input_table["mainlist"]) +function download_subtitle(index) + if not index then + index = get_first_sel(input_table["mainlist"]) + end if index == 0 then setMessage(lang["mess_no_selection"])