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
90199a69
Commit
90199a69
authored
Sep 12, 2008
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify and fix some lua scripts.
parent
538b14f9
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
74 additions
and
55 deletions
+74
-55
share/lua/meta/01_musicbrainz.lua
share/lua/meta/01_musicbrainz.lua
+1
-1
share/lua/playlist/appletrailers.lua
share/lua/playlist/appletrailers.lua
+17
-14
share/lua/playlist/break.lua
share/lua/playlist/break.lua
+7
-6
share/lua/playlist/canalplus.lua
share/lua/playlist/canalplus.lua
+9
-8
share/lua/playlist/dailymotion.lua
share/lua/playlist/dailymotion.lua
+13
-5
share/lua/playlist/france2.lua
share/lua/playlist/france2.lua
+4
-3
share/lua/playlist/googlevideo.lua
share/lua/playlist/googlevideo.lua
+6
-5
share/lua/playlist/megavideo.lua
share/lua/playlist/megavideo.lua
+2
-2
share/lua/playlist/metacafe.lua
share/lua/playlist/metacafe.lua
+6
-4
share/lua/playlist/youtube.lua
share/lua/playlist/youtube.lua
+9
-7
No files found.
share/lua/meta/01_musicbrainz.lua
View file @
90199a69
...
...
@@ -45,7 +45,7 @@ function fetch_art()
local
page
=
s
:
read
(
65653
)
-- FIXME: multiple results may be available
asin
=
string.gsub
(
page
,
"^.*<asin>([^<]*)</asin>.*$"
,
"%1
"
)
_
,
_
,
asin
=
string.find
(
page
,
"<asin>(.-)</asin>
"
)
if
asin
~=
page
then
return
"http://images.amazon.com/images/P/"
..
asin
..
".01._SCLZZZZZZZ_.jpg"
else
...
...
share/lua/playlist/appletrailers.lua
View file @
90199a69
...
...
@@ -23,7 +23,12 @@
-- Probe function.
function
probe
()
return
vlc
.
access
==
"http"
and
string.match
(
vlc
.
path
,
"trailers.apple.com"
)
and
string.match
(
vlc
.
path
,
"www.apple.com/trailers"
)
end
function
find
(
haystack
,
needle
)
local
_
,
_
,
r
=
string.find
(
haystack
,
needle
)
return
r
end
-- Parse function.
...
...
@@ -33,19 +38,17 @@ function parse()
do
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
string.match
(
line
,
"http://movies.apple.com/movies/.*%.mov"
)
or
string.match
(
line
,
"http://images.apple.com/movies/.*%.mov"
)
then
if
string.match
(
line
,
"http://movies.apple.com/movies/.*%.mov"
)
then
path
=
vlc
.
strings
.
decode_uri
(
string.gsub
(
line
,
"^.*(http://movies.apple.com/movies/.*%.mov).*$"
,
"%1"
)
)
elseif
string.match
(
line
,
"http://images.apple.com/movies/.*%.mov"
)
then
path
=
vlc
.
strings
.
decode_uri
(
string.gsub
(
line
,
"^.*(http://images.apple.com/movies/.*%.mov).*$"
,
"%1"
)
)
end
if
string.match
(
path
,
"480p"
)
then
for
path
in
string.gmatch
(
line
,
"http://movies.apple.com/movies/.-%.mov"
)
do
path
=
vlc
.
strings
.
decode_uri
(
path
)
if
string.match
(
path
,
"320"
)
then
extraname
=
" (320p)"
elseif
string.match
(
path
,
"480"
)
then
extraname
=
" (480p)"
elseif
string.match
(
path
,
"720p"
)
then
elseif
string.match
(
path
,
"640"
)
then
extraname
=
" (640p)"
elseif
string.match
(
path
,
"720"
)
then
extraname
=
" (720p)"
elseif
string.match
(
path
,
"1080
p
"
)
then
elseif
string.match
(
path
,
"1080"
)
then
extraname
=
" (1080p)"
else
extraname
=
""
...
...
@@ -54,11 +57,11 @@ function parse()
end
if
string.match
(
line
,
"<title>"
)
then
title
=
vlc
.
strings
.
decode_uri
(
string.gsub
(
line
,
"^.*<title>([^<]*).*$"
,
"%1
"
)
)
title
=
vlc
.
strings
.
decode_uri
(
find
(
line
,
"<title>(.-)<
"
)
)
end
if
string.match
(
line
,
"<meta name=\"
Description
\
""
)
then
description
=
vlc
.
strings
.
resolve_xml_special_chars
(
string.gsub
(
line
,
"^.*name=\"
Description
\
" content=\"
([
^
\
"]*)\"
.
*
$
", "
%
1
" ) )
description
=
vlc
.
strings
.
resolve_xml_special_chars
(
find
(
line
,
"name=\"
Description
\
" content=\"
(.
-
)
\
"
"
)
)
end
end
return
p
...
...
share/lua/playlist/break.lua
View file @
90199a69
...
...
@@ -21,7 +21,7 @@
-- Probe function.
function
probe
()
return
vlc
.
access
==
"http"
and
string.match
(
vlc
.
path
,
"
www.
break.com"
)
and
string.match
(
vlc
.
path
,
"break.com"
)
end
-- Parse function.
...
...
@@ -34,19 +34,20 @@ function parse()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
string.match
(
line
,
"sGlobalContentFilePath="
)
then
filepath
=
string.gsub
(
line
,
".*sGlobalContentFilePath='([^']*).*"
,
"%1
"
)
_
,
_
,
filepath
=
string.find
(
line
,
"sGlobalContentFilePath='(.-)'
"
)
end
if
string.match
(
line
,
"sGlobalFileName="
)
then
filename
=
string.gsub
(
line
,
".*sGlobalFileName='([^']*).*"
,
"%1
"
)
_
,
_
,
filename
=
string.find
(
line
,
".*sGlobalFileName='(.-)'
"
)
end
if
string.match
(
line
,
"sGlobalContentTitle="
)
then
filetitle
=
string.gsub
(
line
,
".*sGlobalContentTitle='([^']*).*"
,
"%1
"
)
_
,
_
,
filetitle
=
string.find
(
line
,
"sGlobalContentTitle='(.-)'
"
)
end
if
string.match
(
line
,
"el=\"
videothumbnail
\
" href=\"" ) then
arturl = string.gsub( line, "
.
*
el
=
\
"videothumbnail\"
href
=
\
"([^\"
]
*
).
*
", "
%
1
" )
_,_,arturl = string.find( line, "
el
=
\
"videothumbnail\"
href
=
\
"(.-)\"
" )
end
if string.match( line, "
videoPath
" ) then
return { { path = ( string.gsub( line, "
.
*
videoPath
', '
([
^
']*).*", "%1" ) )..filepath.."/"..filename..".flv"; title = filetitle; arturl = arturl } }
_,_,videopath = string.find( line, "
.
*
videoPath
', '
(.
-
)
'" )
return { { path = videopath..filepath.."/"..filename..".flv"; title = filetitle; arturl = arturl } }
end
end
end
share/lua/playlist/canalplus.lua
View file @
90199a69
...
...
@@ -27,8 +27,9 @@ end
function
parse
()
p
=
{}
--vlc.msg.dbg( vlc.path )
if
string.match
(
vlc
.
path
,
"www.canalplus.fr/
index.php%?pid=
"
)
if
string.match
(
vlc
.
path
,
"www.canalplus.fr/
.*%?pid=.*
"
)
then
-- This is the HTML page's URL
local
_
,
_
,
pid
=
string.find
(
vlc
.
path
,
"pid(%d-)%-"
)
local
id
,
name
,
description
,
arturl
while
true
do
-- Try to find the video's title
...
...
@@ -37,12 +38,12 @@ function parse()
-- vlc.msg.dbg( line )
if
string.match
(
line
,
"aVideos"
)
then
if
string.match
(
line
,
"CONTENT_ID.*="
)
then
id
=
string.gsub
(
line
,
"^.*\"
(.
*
)
\
".*$"
,
"%1
"
)
_
,
_
,
id
=
string.find
(
line
,
"
\"
(.-)\"
" )
elseif string.match( line, "
CONTENT_VNC_TITRE
" ) then
arturl
=
string.gsub
(
line
,
"^.*src=\"
(.
*
)
\
".*$"
,
"%1
"
)
name
=
string.gsub
(
line
,
"^.*title=\"
(.
*
)
\
".*$"
,
"%1
"
)
_,_,arturl = string.find( line, "
src
=
\
"(.-)\"
" )
_,_,name = string.find( line, "
title
=
\
"(.-)\"
" )
elseif string.match( line, "
CONTENT_VNC_DESCRIPTION
" ) then
description
=
string.gsub
(
line
,
"^.*\"
(.
*
)
\
".*$"
,
"%1
"
)
_,_,description = string.find( line, "
\
"(.-)\"
" )
end
if id and string.match( line, "
new
Array
" ) then
add_item( p, id, name, description, arturl )
...
...
@@ -63,16 +64,16 @@ function parse()
if not line then break end
--vlc.msg.dbg( line )
if string.match( line, "
<
hi
" ) then
local
path
=
string.gsub
(
line
,
"^.*%[(.-)%].*$"
,
"%1
"
)
local
_,_,path = string.find( line, "
%
[(
http
.
-
)
%
]
" )
return { { path = path } }
end
end
vlc
.
msg
.
err
(
"canalplus: can't find video in page"
)
end
end
function get_url_param( url, name )
return
string.gsub
(
url
,
"^.*[&?]"
..
name
..
"=([^&]*).*$"
,
"%1"
)
local _,_,ret = string.find( url, "
[
&?
]
"..name.."
=
([
^
&
]
*
)
" )
return ret
end
function add_item( p, id, name, description, arturl )
...
...
share/lua/playlist/dailymotion.lua
View file @
90199a69
...
...
@@ -25,7 +25,12 @@
function
probe
()
return
vlc
.
access
==
"http"
and
string.match
(
vlc
.
path
,
"dailymotion.com"
)
and
string.match
(
vlc
.
peek
(
256
),
"<!DOCTYPE.*<title>Video "
)
and
string.match
(
vlc
.
peek
(
2048
),
"<!DOCTYPE.*video_type"
)
end
function
find
(
haystack
,
needle
)
local
_
,
_
,
ret
=
string.find
(
haystack
,
needle
)
return
ret
end
-- Parse function.
...
...
@@ -36,8 +41,8 @@ function parse()
if
not
line
then
break
end
if
string.match
(
line
,
"param name=\"
flashvars
\
" value=\"
.
*
video
=
" )
then
arturl = vlc.strings.decode_uri(
string.gsub( line, "
^
.
*
param
name
=
\
"flashvars\"
value
=
\
".*preview=([^&]*).*$"
,
"%1
"
)
)
videos
=
vlc
.
strings
.
decode_uri
(
string.gsub
(
line
,
"^.*param name=\"
flashvars
\
" value=\"
.
*
video
=
([
^
&
]
*
).
*
$
", "
%
1
" ) )
arturl = vlc.strings.decode_uri(
find( line, "
param
name
=
\
"flashvars\"
value
=
\
".*preview=([^&]*)
"
)
)
videos
=
vlc
.
strings
.
decode_uri
(
find
(
line
,
"param name=\"
flashvars
\
" value=\"
.
*
video
=
([
^
&
]
*
)
" ) )
--[[ we get a list of different streams available, at various codecs
and resolutions:
/A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264
...
...
@@ -74,10 +79,13 @@ function parse()
path = "
http
:
//
dailymotion
.
com
" .. available[bestcodec]
end
end
if string.match( line, "
<
meta
name
=
\
"title\"" )
then
name = vlc.strings.resolve_xml_special_chars( find( line, "
name
=
\
"title\"
content
=
\
"(.-)\"" ) )
end
if string.match( line, "
<
meta
name
=
\
"description\"" )
then
name = vlc.strings.resolve_xml_special_chars( string.gsub( line, "
^
.
*
name
=
\
"description\"
content
=
\
"%w+ (.*) %w+ %w+ %w+ %w+ Videos\..*$"
,
"%1"
)
)
description
=
vlc
.
strings
.
resolve_xml_special_chars
(
string.gsub
(
line
,
"^.*name=\"
description
\
" content=\"
%
w
+
.
*
%
w
+
%
w
+
%
w
+
%
w
+
Videos
\
.
([
^
\
"]*)\"
.
*
$
", "
%
1
" ) )
description = vlc.strings.resolve_xml_special_chars( find( line, "
name
=
\
"description\"
content
=
\
"(.-)\"" ) )
end
if path and name and description and arturl then break end
end
...
...
share/lua/playlist/france2.lua
View file @
90199a69
...
...
@@ -34,15 +34,16 @@ function parse()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
string.match
(
line
,
"class=\"
editiondate
\
""
)
then
editiondate
=
string.gsub
(
line
,
"^.*<h1>(.*)</h1>.*$"
,
"%1
"
)
_
,
_
,
editiondate
=
string.find
(
line
,
"<h1>(.-)</h1>
"
)
end
if
string.match
(
line
,
"mms.*%.wmv"
)
then
video
=
string.gsub
(
line
,
"^.*mms(.*%.wmv).*$"
,
"mmsh%1"
)
_
,
_
,
video
=
string.find
(
line
,
"mms(.-%.wmv)"
)
video
=
"mmsh"
..
video
table.insert
(
p
,
{
path
=
video
;
name
=
editiondate
}
)
end
if
string.match
(
line
,
"class=\"
subjecttimer
\
""
)
then
oldtime
=
time
time
=
string.gsub
(
line
,
"^.*href=\"
([
^
\
"]*)\"
.
*
$
", "
%
1
" )
_
,
_
,
time
=
string.find
(
line
,
"href=\"
(.
-
)
\
"
"
)
if
oldtime
then
table.insert
(
p
,
{
path
=
video
;
name
=
name
;
duration
=
time
-
oldtime
;
options
=
{
':start-time='
..
tostring
(
oldtime
);
':stop-time='
..
tostring
(
time
)
}
}
)
end
...
...
share/lua/playlist/googlevideo.lua
View file @
90199a69
...
...
@@ -19,7 +19,8 @@
--]]
function
get_url_param
(
url
,
name
)
return
string.gsub
(
url
,
"^.*[&?]"
..
name
..
"=([^&]*).*$"
,
"%1"
)
local
_
,
_
,
ret
=
string.find
(
url
,
"[&?]"
..
name
..
"=([^&]*)"
)
return
ret
end
-- Probe function.
...
...
@@ -51,22 +52,22 @@ function parse()
if
not
line
then
break
end
if
string.match
(
line
,
"media:content.*flv"
)
then
local
s
=
string.gsub
(
line
,
"^.*<media:content(.-)/>.*$"
,
"%1
"
)
local
_
,
_
,
s
=
string.find
(
line
,
"<media:content(.-)/>
"
)
path
=
vlc
.
strings
.
resolve_xml_special_chars
(
get_arg
(
s
,
"url"
))
duration
=
get_arg
(
s
,
"duration"
)
end
if
string.match
(
line
,
"media:thumbnail"
)
then
local
s
=
string.gsub
(
line
,
"^.*<media:thumbnail(.-)/>.*$"
,
"%1
"
)
local
_
,
_
,
s
=
string.find
(
line
,
"<media:thumbnail(.-)/>
"
)
arturl
=
vlc
.
strings
.
resolve_xml_special_chars
(
get_arg
(
s
,
"url"
))
end
if
string.match
(
line
,
"media:title"
)
then
name
=
string.gsub
(
line
,
"^.*<media:title>(.-)</media:title>.*$"
,
"%1
"
)
_
,
_
,
name
=
string.find
(
line
,
"<media:title>(.-)</media:title>
"
)
end
if
string.match
(
line
,
"media:description"
)
then
description
=
string.gsub
(
line
,
"^.*<media:description>(.-)</media:description>.*$"
,
"%1
"
)
_
,
_
,
description
=
string.find
(
line
,
"<media:description>(.-)</media:description>
"
)
end
end
return
{
{
path
=
path
;
name
=
name
;
arturl
=
arturl
;
duration
=
duration
;
description
=
description
}
}
...
...
share/lua/playlist/megavideo.lua
View file @
90199a69
...
...
@@ -31,7 +31,7 @@ function parse()
-- we have to get the xml
if
string.match
(
vlc
.
path
,
"www.megavideo.com.*&v=.*&u=.*"
)
then
id
=
string.gsub
(
vlc
.
path
,
"www.megavideo.com.*v=([^&]*).*$"
,
"%1
"
)
_
,
_
,
id
=
string.find
(
vlc
.
path
,
"www.megavideo.com.*v=([^&]*)
"
)
path
=
"http://www.megavideo.com/xml/videolink.php?v="
..
id
return
{
{
path
=
path
}
}
end
...
...
@@ -51,7 +51,7 @@ function parse()
line = vlc.readline()
end
-- now gets the encoded url
s = string.gsub( xml, "
.
*
ROW
url
=
\
"([^\"
]
*
).
*
", "
%
1
" )
_,_,s = string.find( xml, "
.
*
ROW
url
=
\
"(.-)\"
" )
path = ""
i = 1
while s:byte(i) do
...
...
share/lua/playlist/metacafe.lua
View file @
90199a69
...
...
@@ -28,6 +28,7 @@ end
-- Parse function.
function
parse
()
vlc
.
msg
.
warn
(
"FIXME"
)
if
string.match
(
vlc
.
path
,
"watch/"
)
then
-- This is the HTML page's URL
while
true
do
...
...
@@ -35,18 +36,19 @@ function parse()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
string.match
(
line
,
"<meta name=\"
title
\
""
)
then
name
=
string.gsub
(
line
,
"^.*content=\"
Metacafe
%-
([
^
\
"]*).*$"
,
"%1
"
)
_
,
_
,
name
=
string.find
(
line
,
"content=\"
Metacafe
%-
(.
-
)
\
"
"
)
end
if
string.match
(
line
,
"<meta name=\"
description
\
""
)
then
description
=
string.gsub
(
line
,
"^.*content=\"
([
^
\
"]*).*$"
,
"%1
"
)
_
,
_
,
description
=
string.find
(
line
,
"content=\"
(.
-
)
\
"
"
)
end
if
string.match
(
line
,
"<link rel=\"
image_src
\
""
)
then
arturl
=
string.gsub
(
line
,
"^.*href=\"
([
^
\
"]*)\"
.
*
$
", "
%
1
" )
_
,
_
,
arturl
=
string.find
(
line
,
"href=\"
(.
-
)
\
"
"
)
end
if
name
and
description
and
arturl
then
break
end
end
return
{
{
path
=
string.gsub
(
vlc
.
path
,
"^.*watch/(.*[^/])/?$"
,
"http://www.metacafe.com/fplayer/%1.swf"
);
name
=
name
;
description
=
description
;
arturl
=
arturl
;
}
}
else
-- This is the flash player's URL
return { { path = string.gsub( vlc.path, "
^
.
*
mediaURL
=
([
^
&
]
*
).
*
$
", "
%
1
" ) } }
local
_
,
_
,
path
=
string.find
(
vlc
.
path
,
"mediaURL=([^&]*)"
)
return
{
{
path
=
path
}
}
end
end
share/lua/playlist/youtube.lua
View file @
90199a69
...
...
@@ -20,7 +20,8 @@
-- Helper function to get a parameter's value in a URL
function
get_url_param
(
url
,
name
)
return
string.gsub
(
url
,
"^.*[&?]"
..
name
..
"=([^&]*).*$"
,
"%1"
)
local
_
,
_
,
res
=
string.find
(
url
,
"[&?]"
..
name
..
"=([^&]*)"
)
return
res
end
function
get_arturl
(
path
,
video_id
)
...
...
@@ -62,22 +63,23 @@ function parse()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
string.match
(
line
,
"<meta name=\"
title
\
""
)
then
name
=
string.gsub
(
line
,
"^.*content=\"
([
^
\
"]*).*$"
,
"%1
"
)
_
,
_
,
name
=
string.find
(
line
,
"content=\"
(.
-
)
\
"
"
)
end
if
string.match
(
line
,
"<meta name=\"
description
\
""
)
then
description
=
string.gsub
(
line
,
"^.*content=\"
([
^
\
"]*).*$"
,
"%1"
)
-- Don't ask me why they double encode ...
_
,
_
,
description
=
vlc
.
strings
.
resolve_xml_special_chars
(
vlc
.
strings
.
resolve_xml_special_chars
(
string.find
(
line
,
"content=\"
(.
-
)
\
""
)))
end
if
string.match
(
line
,
"subscribe_to_user="
)
then
artist
=
string.gsub
(
line
,
".*subscribe_to_user=([^&]*).*"
,
"%1
"
)
_
,
_
,
artist
=
string.find
(
line
,
"subscribe_to_user=([^&]*)
"
)
end
-- OLD: var swfArgs = {hl:'en',BASE_YT_URL:'http://youtube.com/',video_id:'XPJ7d8dq0t8',l:'292',t:'OEgsToPDskLFdOYrrlDm3FQPoQBYaCP1',sk:'0gnr-AE6QZJEZmCMd3lq_AC'};
-- NEW: var swfArgs = { "BASE_YT_URL": "http://youtube.com", "video_id": "OHVvVmUNBFc", "l": 88, "sk": "WswKuJzDBsdD6oG3IakCXgC", "t": "OEgsToPDskK3zO44y0QN8Fr5ZSAZwCQp", "plid": "AARGnwWMrmGkbpOxAAAA4AT4IAA", "tk": "mEL4E7PqHeaZp5OG19NQThHt9mXJU4PbRTOw6lz9osHi4Hixp7RE1w=="};
if
string.match
(
line
,
"swfArgs"
)
and
string.match
(
line
,
"video_id"
)
then
if
string.match
(
line
,
"BASE_YT_URL"
)
then
base_yt_url
=
string.gsub
(
line
,
".*\"
BASE_YT_URL
\
": \"
([
^
\
"]*).*"
,
"%1
"
)
_
,
_
,
base_yt_url
=
string.find
(
line
,
"
\"
BASE_YT_URL\"
:
\
"(.-)\"
" )
end
t
=
string.gsub
(
line
,
".*\"
t
\
": \"
([
^
\
"]*).*"
,
"%1
"
)
-- vlc.msg
_
err( t )
_,_,t = string.find( line, "
\
"t\"
:
\
"(.-)\"
" )
-- vlc.msg
.
err( t )
-- video_id = string.gsub( line, "
.
*
&
video_id
:
'([^'
]
*
)
'.*", "%1" )
end
if name and description and artist --[[and video_id]] then break end
...
...
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