Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
4b07f728
Commit
4b07f728
authored
Nov 11, 2014
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: Update VLSub to 0.9.13
parent
bc161d90
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
28 deletions
+45
-28
share/lua/extensions/VLSub.lua
share/lua/extensions/VLSub.lua
+45
-28
No files found.
share/lua/extensions/VLSub.lua
View file @
4b07f728
...
@@ -95,13 +95,13 @@ local options = {
...
@@ -95,13 +95,13 @@ local options = {
Download subtitles from
Download subtitles from
<a href='http://www.opensubtitles.org/'>
<a href='http://www.opensubtitles.org/'>
opensubtitles.org
opensubtitles.org
</a> and display them while watching a video.<br>
"..
</a> and display them while watching a video.<br>
<br>
<br>
<b><u>Usage:</u></b><br>
<b><u>Usage:</u></b><br>
<br>
<br>
VLSub is meant to be used while you are watching the video,
Start your video. If you use Vlsub witout playing a video
so start it first (if nothing is playing you will get a link
you will get a link to download the subtitles in your browser
to download the subtitles in your browser)
.<br>
but the subtitles won't be saved and loaded automatically
.<br>
<br>
<br>
Choose the language for your subtitles and click on the
Choose the language for your subtitles and click on the
button corresponding to one of the two research methods
button corresponding to one of the two research methods
...
@@ -326,8 +326,8 @@ local select_conf = {} -- Drop down widget / option table association
...
@@ -326,8 +326,8 @@ local select_conf = {} -- Drop down widget / option table association
function descriptor()
function descriptor()
return {
return {
title = "VLsub 0.9.1
2
",
title = "VLsub 0.9.1
3
",
version = "0.9.1
2
",
version = "0.9.1
3
",
author = "exebetche",
author = "exebetche",
url = '
http
:
//
www
.
opensubtitles
.
org
/
',
url = '
http
:
//
www
.
opensubtitles
.
org
/
',
shortdesc = "VLsub";
shortdesc = "VLsub";
...
@@ -1667,7 +1667,8 @@ function download_subtitles()
...
@@ -1667,7 +1667,8 @@ function download_subtitles()
local
item
=
openSub
.
itemStore
[
index
]
local
item
=
openSub
.
itemStore
[
index
]
if
openSub
.
option
.
downloadBehaviour
==
'manual'
then
if
openSub
.
option
.
downloadBehaviour
==
'manual'
or
not
subfileName
then
local
link
=
"<span style='color:#181'>"
local
link
=
"<span style='color:#181'>"
link
=
link
..
"<b>"
..
lang
[
"mess_dowload_link"
]
..
":</b>"
link
=
link
..
"<b>"
..
lang
[
"mess_dowload_link"
]
..
":</b>"
link
=
link
..
"</span> "
link
=
link
..
"</span> "
...
@@ -1866,34 +1867,50 @@ function http_req(host, port, request)
...
@@ -1866,34 +1867,50 @@ function http_req(host, port, request)
vlc
.
net
.
send
(
fd
,
request
)
vlc
.
net
.
send
(
fd
,
request
)
vlc
.
net
.
poll
(
pollfds
)
vlc
.
net
.
poll
(
pollfds
)
local
response
=
vlc
.
net
.
recv
(
fd
,
2048
)
local
chunk
=
vlc
.
net
.
recv
(
fd
,
2048
)
local
headerStr
,
body
=
string.match
(
response
,
"(.-\r?\n)\r?\n(.*)"
)
local
response
=
""
local
header
=
parse_header
(
headerStr
)
local
headerStr
,
header
,
body
local
contentLength
=
tonumber
(
header
[
"Content-Length"
])
local
contentLength
,
status
local
TransferEncoding
=
header
[
"Transfer-Encoding"
]
local
status
=
tonumber
(
header
[
"statuscode"
])
local
bodyLenght
=
string.len
(
body
)
local
pct
=
0
local
pct
=
0
--~ if status ~= 200 then return status end
while
chunk
do
response
=
response
..
chunk
while
contentLength
and
bodyLenght
<
contentLength
do
if
not
header
then
vlc
.
net
.
poll
(
pollfds
)
headerStr
,
body
=
response
:
match
(
"(.-\r?\n)\r?\n(.*)"
)
response
=
vlc
.
net
.
recv
(
fd
,
1024
)
if
headerStr
then
response
=
body
if
response
then
header
=
parse_header
(
headerStr
)
body
=
body
..
response
contentLength
=
tonumber
(
header
[
"Content-Length"
])
else
status
=
tonumber
(
header
[
"statuscode"
])
vlc
.
net
.
close
(
fd
)
return
false
end
end
bodyLenght
=
string.len
(
body
)
end
if
contentLength
then
bodyLenght
=
#
response
pct
=
bodyLenght
/
contentLength
*
100
pct
=
bodyLenght
/
contentLength
*
100
setMessage
(
openSub
.
actionLabel
..
": "
..
progressBarContent
(
pct
))
setMessage
(
openSub
.
actionLabel
..
": "
..
progressBarContent
(
pct
))
if
bodyLenght
>=
contentLength
then
break
end
end
end
vlc
.
net
.
poll
(
pollfds
)
chunk
=
vlc
.
net
.
recv
(
fd
,
1024
)
end
vlc
.
net
.
close
(
fd
)
vlc
.
net
.
close
(
fd
)
return
status
,
body
if
status
==
301
and
header
[
"Location"
]
then
local
host
,
path
=
parse_url
(
trim
(
header
[
"Location"
]))
request
=
request
:
gsub
(
"^
([^
%s
]
+
)([^
%s
]
+
)
"
,
"%1"
..path
)
:
gsub
(
"
(
Host:
)([^\
n
]
*
)
"
,
"%1"
..host
)
return
http_req
(
host
,
port
,
request
)
end
return
status
,
response
end
end
function
parse_header
(
data
)
function
parse_header
(
data
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment