Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
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
Hide 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()
...
@@ -45,7 +45,7 @@ function fetch_art()
local
page
=
s
:
read
(
65653
)
local
page
=
s
:
read
(
65653
)
-- FIXME: multiple results may be available
-- FIXME: multiple results may be available
asin
=
string.gsub
(
page
,
"^.*<asin>([^<]*)</asin>.*$"
,
"%1
"
)
_
,
_
,
asin
=
string.find
(
page
,
"<asin>(.-)</asin>
"
)
if
asin
~=
page
then
if
asin
~=
page
then
return
"http://images.amazon.com/images/P/"
..
asin
..
".01._SCLZZZZZZZ_.jpg"
return
"http://images.amazon.com/images/P/"
..
asin
..
".01._SCLZZZZZZZ_.jpg"
else
else
...
...
share/lua/playlist/appletrailers.lua
View file @
90199a69
...
@@ -23,7 +23,12 @@
...
@@ -23,7 +23,12 @@
-- Probe function.
-- Probe function.
function
probe
()
function
probe
()
return
vlc
.
access
==
"http"
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
end
-- Parse function.
-- Parse function.
...
@@ -33,19 +38,17 @@ function parse()
...
@@ -33,19 +38,17 @@ function parse()
do
do
line
=
vlc
.
readline
()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
not
line
then
break
end
if
string.match
(
line
,
"http://movies.apple.com/movies/.*%.mov"
)
for
path
in
string.gmatch
(
line
,
"http://movies.apple.com/movies/.-%.mov"
)
do
or
string.match
(
line
,
"http://images.apple.com/movies/.*%.mov"
)
path
=
vlc
.
strings
.
decode_uri
(
path
)
then
if
string.match
(
path
,
"320"
)
then
if
string.match
(
line
,
"http://movies.apple.com/movies/.*%.mov"
)
then
extraname
=
" (320p)"
path
=
vlc
.
strings
.
decode_uri
(
string.gsub
(
line
,
"^.*(http://movies.apple.com/movies/.*%.mov).*$"
,
"%1"
)
)
elseif
string.match
(
path
,
"480"
)
then
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
extraname
=
" (480p)"
extraname
=
" (480p)"
elseif
string.match
(
path
,
"720p"
)
then
elseif
string.match
(
path
,
"640"
)
then
extraname
=
" (640p)"
elseif
string.match
(
path
,
"720"
)
then
extraname
=
" (720p)"
extraname
=
" (720p)"
elseif
string.match
(
path
,
"1080
p
"
)
then
elseif
string.match
(
path
,
"1080"
)
then
extraname
=
" (1080p)"
extraname
=
" (1080p)"
else
else
extraname
=
""
extraname
=
""
...
@@ -54,11 +57,11 @@ function parse()
...
@@ -54,11 +57,11 @@ function parse()
end
end
if
string.match
(
line
,
"<title>"
)
if
string.match
(
line
,
"<title>"
)
then
then
title
=
vlc
.
strings
.
decode_uri
(
string.gsub
(
line
,
"^.*<title>([^<]*).*$"
,
"%1
"
)
)
title
=
vlc
.
strings
.
decode_uri
(
find
(
line
,
"<title>(.-)<
"
)
)
end
end
if
string.match
(
line
,
"<meta name=\"
Description
\
""
)
if
string.match
(
line
,
"<meta name=\"
Description
\
""
)
then
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
end
end
return
p
return
p
...
...
share/lua/playlist/break.lua
View file @
90199a69
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
-- Probe function.
-- Probe function.
function
probe
()
function
probe
()
return
vlc
.
access
==
"http"
return
vlc
.
access
==
"http"
and
string.match
(
vlc
.
path
,
"
www.
break.com"
)
and
string.match
(
vlc
.
path
,
"break.com"
)
end
end
-- Parse function.
-- Parse function.
...
@@ -34,19 +34,20 @@ function parse()
...
@@ -34,19 +34,20 @@ function parse()
line
=
vlc
.
readline
()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
not
line
then
break
end
if
string.match
(
line
,
"sGlobalContentFilePath="
)
then
if
string.match
(
line
,
"sGlobalContentFilePath="
)
then
filepath
=
string.gsub
(
line
,
".*sGlobalContentFilePath='([^']*).*"
,
"%1
"
)
_
,
_
,
filepath
=
string.find
(
line
,
"sGlobalContentFilePath='(.-)'
"
)
end
end
if
string.match
(
line
,
"sGlobalFileName="
)
then
if
string.match
(
line
,
"sGlobalFileName="
)
then
filename
=
string.gsub
(
line
,
".*sGlobalFileName='([^']*).*"
,
"%1
"
)
_
,
_
,
filename
=
string.find
(
line
,
".*sGlobalFileName='(.-)'
"
)
end
end
if
string.match
(
line
,
"sGlobalContentTitle="
)
then
if
string.match
(
line
,
"sGlobalContentTitle="
)
then
filetitle
=
string.gsub
(
line
,
".*sGlobalContentTitle='([^']*).*"
,
"%1
"
)
_
,
_
,
filetitle
=
string.find
(
line
,
"sGlobalContentTitle='(.-)'
"
)
end
end
if
string.match
(
line
,
"el=\"
videothumbnail
\
" href=\"" ) then
if
string.match
(
line
,
"el=\"
videothumbnail
\
" href=\"" ) then
arturl = string.gsub( line, "
.
*
el
=
\
"videothumbnail\"
href
=
\
"([^\"
]
*
).
*
", "
%
1
" )
_,_,arturl = string.find( line, "
el
=
\
"videothumbnail\"
href
=
\
"(.-)\"
" )
end
end
if string.match( line, "
videoPath
" ) then
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
end
end
end
share/lua/playlist/canalplus.lua
View file @
90199a69
...
@@ -27,8 +27,9 @@ end
...
@@ -27,8 +27,9 @@ end
function
parse
()
function
parse
()
p
=
{}
p
=
{}
--vlc.msg.dbg( vlc.path )
--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
then
-- This is the HTML page's URL
local
_
,
_
,
pid
=
string.find
(
vlc
.
path
,
"pid(%d-)%-"
)
local
id
,
name
,
description
,
arturl
local
id
,
name
,
description
,
arturl
while
true
do
while
true
do
-- Try to find the video's title
-- Try to find the video's title
...
@@ -37,12 +38,12 @@ function parse()
...
@@ -37,12 +38,12 @@ function parse()
-- vlc.msg.dbg( line )
-- vlc.msg.dbg( line )
if
string.match
(
line
,
"aVideos"
)
then
if
string.match
(
line
,
"aVideos"
)
then
if
string.match
(
line
,
"CONTENT_ID.*="
)
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
elseif string.match( line, "
CONTENT_VNC_TITRE
" ) then
arturl
=
string.gsub
(
line
,
"^.*src=\"
(.
*
)
\
".*$"
,
"%1
"
)
_,_,arturl = string.find( line, "
src
=
\
"(.-)\"
" )
name
=
string.gsub
(
line
,
"^.*title=\"
(.
*
)
\
".*$"
,
"%1
"
)
_,_,name = string.find( line, "
title
=
\
"(.-)\"
" )
elseif string.match( line, "
CONTENT_VNC_DESCRIPTION
" ) then
elseif string.match( line, "
CONTENT_VNC_DESCRIPTION
" ) then
description
=
string.gsub
(
line
,
"^.*\"
(.
*
)
\
".*$"
,
"%1
"
)
_,_,description = string.find( line, "
\
"(.-)\"
" )
end
end
if id and string.match( line, "
new
Array
" ) then
if id and string.match( line, "
new
Array
" ) then
add_item( p, id, name, description, arturl )
add_item( p, id, name, description, arturl )
...
@@ -63,16 +64,16 @@ function parse()
...
@@ -63,16 +64,16 @@ function parse()
if not line then break end
if not line then break end
--vlc.msg.dbg( line )
--vlc.msg.dbg( line )
if string.match( line, "
<
hi
" ) then
if string.match( line, "
<
hi
" ) then
local
path
=
string.gsub
(
line
,
"^.*%[(.-)%].*$"
,
"%1
"
)
local
_,_,path = string.find( line, "
%
[(
http
.
-
)
%
]
" )
return { { path = path } }
return { { path = path } }
end
end
end
end
vlc
.
msg
.
err
(
"canalplus: can't find video in page"
)
end
end
end
end
function get_url_param( url, name )
function get_url_param( url, name )
return
string.gsub
(
url
,
"^.*[&?]"
..
name
..
"=([^&]*).*$"
,
"%1"
)
local _,_,ret = string.find( url, "
[
&?
]
"..name.."
=
([
^
&
]
*
)
" )
return ret
end
end
function add_item( p, id, name, description, arturl )
function add_item( p, id, name, description, arturl )
...
...
share/lua/playlist/dailymotion.lua
View file @
90199a69
...
@@ -25,7 +25,12 @@
...
@@ -25,7 +25,12 @@
function
probe
()
function
probe
()
return
vlc
.
access
==
"http"
return
vlc
.
access
==
"http"
and
string.match
(
vlc
.
path
,
"dailymotion.com"
)
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
end
-- Parse function.
-- Parse function.
...
@@ -36,8 +41,8 @@ function parse()
...
@@ -36,8 +41,8 @@ function parse()
if
not
line
then
break
end
if
not
line
then
break
end
if
string.match
(
line
,
"param name=\"
flashvars
\
" value=\"
.
*
video
=
" )
if
string.match
(
line
,
"param name=\"
flashvars
\
" value=\"
.
*
video
=
" )
then
then
arturl = vlc.strings.decode_uri(
string.gsub( line, "
^
.
*
param
name
=
\
"flashvars\"
value
=
\
".*preview=([^&]*).*$"
,
"%1
"
)
)
arturl = vlc.strings.decode_uri(
find( line, "
param
name
=
\
"flashvars\"
value
=
\
".*preview=([^&]*)
"
)
)
videos
=
vlc
.
strings
.
decode_uri
(
string.gsub
(
line
,
"^.*param name=\"
flashvars
\
" value=\"
.
*
video
=
([
^
&
]
*
).
*
$
", "
%
1
" ) )
videos
=
vlc
.
strings
.
decode_uri
(
find
(
line
,
"param name=\"
flashvars
\
" value=\"
.
*
video
=
([
^
&
]
*
)
" ) )
--[[ we get a list of different streams available, at various codecs
--[[ we get a list of different streams available, at various codecs
and resolutions:
and resolutions:
/A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264
/A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264
...
@@ -74,10 +79,13 @@ function parse()
...
@@ -74,10 +79,13 @@ function parse()
path = "
http
:
//
dailymotion
.
com
" .. available[bestcodec]
path = "
http
:
//
dailymotion
.
com
" .. available[bestcodec]
end
end
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\"" )
if string.match( line, "
<
meta
name
=
\
"description\"" )
then
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( find( line, "
name
=
\
"description\"
content
=
\
"(.-)\"" ) )
description
=
vlc
.
strings
.
resolve_xml_special_chars
(
string.gsub
(
line
,
"^.*name=\"
description
\
" content=\"
%
w
+
.
*
%
w
+
%
w
+
%
w
+
%
w
+
Videos
\
.
([
^
\
"]*)\"
.
*
$
", "
%
1
" ) )
end
end
if path and name and description and arturl then break end
if path and name and description and arturl then break end
end
end
...
...
share/lua/playlist/france2.lua
View file @
90199a69
...
@@ -34,15 +34,16 @@ function parse()
...
@@ -34,15 +34,16 @@ function parse()
line
=
vlc
.
readline
()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
not
line
then
break
end
if
string.match
(
line
,
"class=\"
editiondate
\
""
)
then
if
string.match
(
line
,
"class=\"
editiondate
\
""
)
then
editiondate
=
string.gsub
(
line
,
"^.*<h1>(.*)</h1>.*$"
,
"%1
"
)
_
,
_
,
editiondate
=
string.find
(
line
,
"<h1>(.-)</h1>
"
)
end
end
if
string.match
(
line
,
"mms.*%.wmv"
)
then
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
}
)
table.insert
(
p
,
{
path
=
video
;
name
=
editiondate
}
)
end
end
if
string.match
(
line
,
"class=\"
subjecttimer
\
""
)
then
if
string.match
(
line
,
"class=\"
subjecttimer
\
""
)
then
oldtime
=
time
oldtime
=
time
time
=
string.gsub
(
line
,
"^.*href=\"
([
^
\
"]*)\"
.
*
$
", "
%
1
" )
_
,
_
,
time
=
string.find
(
line
,
"href=\"
(.
-
)
\
"
"
)
if
oldtime
then
if
oldtime
then
table.insert
(
p
,
{
path
=
video
;
name
=
name
;
duration
=
time
-
oldtime
;
options
=
{
':start-time='
..
tostring
(
oldtime
);
':stop-time='
..
tostring
(
time
)
}
}
)
table.insert
(
p
,
{
path
=
video
;
name
=
name
;
duration
=
time
-
oldtime
;
options
=
{
':start-time='
..
tostring
(
oldtime
);
':stop-time='
..
tostring
(
time
)
}
}
)
end
end
...
...
share/lua/playlist/googlevideo.lua
View file @
90199a69
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
--]]
--]]
function
get_url_param
(
url
,
name
)
function
get_url_param
(
url
,
name
)
return
string.gsub
(
url
,
"^.*[&?]"
..
name
..
"=([^&]*).*$"
,
"%1"
)
local
_
,
_
,
ret
=
string.find
(
url
,
"[&?]"
..
name
..
"=([^&]*)"
)
return
ret
end
end
-- Probe function.
-- Probe function.
...
@@ -51,22 +52,22 @@ function parse()
...
@@ -51,22 +52,22 @@ function parse()
if
not
line
then
break
end
if
not
line
then
break
end
if
string.match
(
line
,
"media:content.*flv"
)
if
string.match
(
line
,
"media:content.*flv"
)
then
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"
))
path
=
vlc
.
strings
.
resolve_xml_special_chars
(
get_arg
(
s
,
"url"
))
duration
=
get_arg
(
s
,
"duration"
)
duration
=
get_arg
(
s
,
"duration"
)
end
end
if
string.match
(
line
,
"media:thumbnail"
)
if
string.match
(
line
,
"media:thumbnail"
)
then
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"
))
arturl
=
vlc
.
strings
.
resolve_xml_special_chars
(
get_arg
(
s
,
"url"
))
end
end
if
string.match
(
line
,
"media:title"
)
if
string.match
(
line
,
"media:title"
)
then
then
name
=
string.gsub
(
line
,
"^.*<media:title>(.-)</media:title>.*$"
,
"%1
"
)
_
,
_
,
name
=
string.find
(
line
,
"<media:title>(.-)</media:title>
"
)
end
end
if
string.match
(
line
,
"media:description"
)
if
string.match
(
line
,
"media:description"
)
then
then
description
=
string.gsub
(
line
,
"^.*<media:description>(.-)</media:description>.*$"
,
"%1
"
)
_
,
_
,
description
=
string.find
(
line
,
"<media:description>(.-)</media:description>
"
)
end
end
end
end
return
{
{
path
=
path
;
name
=
name
;
arturl
=
arturl
;
duration
=
duration
;
description
=
description
}
}
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()
...
@@ -31,7 +31,7 @@ function parse()
-- we have to get the xml
-- we have to get the xml
if
string.match
(
vlc
.
path
,
"www.megavideo.com.*&v=.*&u=.*"
)
then
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
path
=
"http://www.megavideo.com/xml/videolink.php?v="
..
id
return
{
{
path
=
path
}
}
return
{
{
path
=
path
}
}
end
end
...
@@ -51,7 +51,7 @@ function parse()
...
@@ -51,7 +51,7 @@ function parse()
line = vlc.readline()
line = vlc.readline()
end
end
-- now gets the encoded url
-- now gets the encoded url
s = string.gsub( xml, "
.
*
ROW
url
=
\
"([^\"
]
*
).
*
", "
%
1
" )
_,_,s = string.find( xml, "
.
*
ROW
url
=
\
"(.-)\"
" )
path = ""
path = ""
i = 1
i = 1
while s:byte(i) do
while s:byte(i) do
...
...
share/lua/playlist/metacafe.lua
View file @
90199a69
...
@@ -28,6 +28,7 @@ end
...
@@ -28,6 +28,7 @@ end
-- Parse function.
-- Parse function.
function
parse
()
function
parse
()
vlc
.
msg
.
warn
(
"FIXME"
)
if
string.match
(
vlc
.
path
,
"watch/"
)
if
string.match
(
vlc
.
path
,
"watch/"
)
then
-- This is the HTML page's URL
then
-- This is the HTML page's URL
while
true
do
while
true
do
...
@@ -35,18 +36,19 @@ function parse()
...
@@ -35,18 +36,19 @@ function parse()
line
=
vlc
.
readline
()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
not
line
then
break
end
if
string.match
(
line
,
"<meta name=\"
title
\
""
)
then
if
string.match
(
line
,
"<meta name=\"
title
\
""
)
then
name
=
string.gsub
(
line
,
"^.*content=\"
Metacafe
%-
([
^
\
"]*).*$"
,
"%1
"
)
_
,
_
,
name
=
string.find
(
line
,
"content=\"
Metacafe
%-
(.
-
)
\
"
"
)
end
end
if
string.match
(
line
,
"<meta name=\"
description
\
""
)
then
if
string.match
(
line
,
"<meta name=\"
description
\
""
)
then
description
=
string.gsub
(
line
,
"^.*content=\"
([
^
\
"]*).*$"
,
"%1
"
)
_
,
_
,
description
=
string.find
(
line
,
"content=\"
(.
-
)
\
"
"
)
end
end
if
string.match
(
line
,
"<link rel=\"
image_src
\
""
)
then
if
string.match
(
line
,
"<link rel=\"
image_src
\
""
)
then
arturl
=
string.gsub
(
line
,
"^.*href=\"
([
^
\
"]*)\"
.
*
$
", "
%
1
" )
_
,
_
,
arturl
=
string.find
(
line
,
"href=\"
(.
-
)
\
"
"
)
end
end
if
name
and
description
and
arturl
then
break
end
if
name
and
description
and
arturl
then
break
end
end
end
return
{
{
path
=
string.gsub
(
vlc
.
path
,
"^.*watch/(.*[^/])/?$"
,
"http://www.metacafe.com/fplayer/%1.swf"
);
name
=
name
;
description
=
description
;
arturl
=
arturl
;
}
}
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
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
end
end
share/lua/playlist/youtube.lua
View file @
90199a69
...
@@ -20,7 +20,8 @@
...
@@ -20,7 +20,8 @@
-- Helper function to get a parameter's value in a URL
-- Helper function to get a parameter's value in a URL
function
get_url_param
(
url
,
name
)
function
get_url_param
(
url
,
name
)
return
string.gsub
(
url
,
"^.*[&?]"
..
name
..
"=([^&]*).*$"
,
"%1"
)
local
_
,
_
,
res
=
string.find
(
url
,
"[&?]"
..
name
..
"=([^&]*)"
)
return
res
end
end
function
get_arturl
(
path
,
video_id
)
function
get_arturl
(
path
,
video_id
)
...
@@ -62,22 +63,23 @@ function parse()
...
@@ -62,22 +63,23 @@ function parse()
line
=
vlc
.
readline
()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
not
line
then
break
end
if
string.match
(
line
,
"<meta name=\"
title
\
""
)
then
if
string.match
(
line
,
"<meta name=\"
title
\
""
)
then
name
=
string.gsub
(
line
,
"^.*content=\"
([
^
\
"]*).*$"
,
"%1
"
)
_
,
_
,
name
=
string.find
(
line
,
"content=\"
(.
-
)
\
"
"
)
end
end
if
string.match
(
line
,
"<meta name=\"
description
\
""
)
then
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
end
if
string.match
(
line
,
"subscribe_to_user="
)
then
if
string.match
(
line
,
"subscribe_to_user="
)
then
artist
=
string.gsub
(
line
,
".*subscribe_to_user=([^&]*).*"
,
"%1
"
)
_
,
_
,
artist
=
string.find
(
line
,
"subscribe_to_user=([^&]*)
"
)
end
end
-- OLD: var swfArgs = {hl:'en',BASE_YT_URL:'http://youtube.com/',video_id:'XPJ7d8dq0t8',l:'292',t:'OEgsToPDskLFdOYrrlDm3FQPoQBYaCP1',sk:'0gnr-AE6QZJEZmCMd3lq_AC'};
-- 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=="};
-- 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
,
"swfArgs"
)
and
string.match
(
line
,
"video_id"
)
then
if
string.match
(
line
,
"BASE_YT_URL"
)
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
end
t
=
string.gsub
(
line
,
".*\"
t
\
": \"
([
^
\
"]*).*"
,
"%1
"
)
_,_,t = string.find( line, "
\
"t\"
:
\
"(.-)\"
" )
-- vlc.msg
_
err( t )
-- vlc.msg
.
err( t )
-- video_id = string.gsub( line, "
.
*
&
video_id
:
'([^'
]
*
)
'.*", "%1" )
-- video_id = string.gsub( line, "
.
*
&
video_id
:
'([^'
]
*
)
'.*", "%1" )
end
end
if name and description and artist --[[and video_id]] then break 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