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 keyboard shortcuts for faster navigation #83

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ To install the translations, copy the directory named "locale" into the VLSub wo
#### USAGE:
* Start Vlc
* Start your video
* Click on the menu View > VLSub or VLC > Extension > VLSub on Mac OS X
* Click on "Search by hash" or "Search by name"
* Click on the menu View > VLSub or VLC > Extension > VLSub on Mac OS X. You can also open the menu by pressing Alt+I, then Alt+V
* Select a subtitles file on the list
* Click on "Download selection"
* Click on "Download selection" or press Alt+D
* That's it, the subtitles should appear on your video.
* If you're not happy with your subtitles (wrong sync etc), you can select an other one and click "Download" again, that will erase the previous one and load it automatically.

Expand Down
30 changes: 22 additions & 8 deletions vlsub.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ local options = {
int_config = 'Config',
int_configuration = 'Configuration',
int_help = 'Help',
int_search_hash = 'Search by hash',
int_search_hash = '&Search by hash',
int_search_name = 'Search by name',
int_title = 'Title',
int_season = 'Season (series)',
int_episode = 'Episode (series)',
int_show_help = 'Show help',
int_show_conf = 'Show config',
int_dowload_sel = 'Download selection',
int_close = 'Close',
int_dowload_sel = '&Download selection',
int_close = '&Close',
int_ok = 'Ok',
int_save = 'Save',
int_cancel = 'Cancel',
Expand Down Expand Up @@ -333,7 +333,7 @@ function descriptor()
version = app_version,
author = "exebetche",
url = 'http://www.opensubtitles.org/',
shortdesc = app_name;
shortdesc = "&"..app_name;
description = options.translation.int_descr,
capabilities = {"menu", "input-listener" }
}
Expand Down Expand Up @@ -556,6 +556,8 @@ function trigger_menu(dlg_id)
dlg = vlc.dialog(
openSub.conf.useragent)
interface_main()
-- Trigger search after window has appeared
searchHash()
elseif dlg_id == 2 then
close_dlg()
dlg = vlc.dialog(
Expand Down Expand Up @@ -1726,9 +1728,16 @@ end
function download_subtitles()
local index = get_first_sel(input_table["mainlist"])

if index == 0 then
setMessage(lang["mess_no_selection"])
return false
local item
if index > 0 then
item = openSub.itemStore[index]
else
if openSub.itemStore[1].MovieReleaseName ~= "" then
item = openSub.itemStore[1]
else
setMessage(lang["mess_no_selection"])
return false
end
end

openSub.actionLabel = lang["mess_downloading"]
Expand Down Expand Up @@ -1824,7 +1833,7 @@ function download_subtitles()
local stream = vlc.stream(tmpFileURI)
local data = ""
local subfile = io.open(target, "wb")

while data do
subfile:write(data)
data = stream:read(65536)
Expand All @@ -1848,6 +1857,11 @@ function download_subtitles()
end

setMessage(message)

-- close vlsub window after downloading
if index == 0 then
close()
end
end

function dump_zip(url, dir, subfileName)
Expand Down