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
add15152
Commit
add15152
authored
May 19, 2007
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* luaplaylist.c, README.txt: add support for VLC options.
* *.lua: misc fixes.
parent
93d0208e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
23 deletions
+65
-23
modules/demux/playlist/luaplaylist.c
modules/demux/playlist/luaplaylist.c
+59
-20
share/luaplaylist/README.txt
share/luaplaylist/README.txt
+4
-1
share/luaplaylist/dailymotion.lua
share/luaplaylist/dailymotion.lua
+1
-1
share/luaplaylist/youtube_homepage.lua
share/luaplaylist/youtube_homepage.lua
+1
-1
No files found.
modules/demux/playlist/luaplaylist.c
View file @
add15152
...
...
@@ -472,35 +472,71 @@ static int Demux( demux_t *p_demux )
{
if
(
lua_istable
(
p_state
,
t
+
2
)
)
{
const
char
*
psz_url
=
NULL
;
const
char
*
psz_title
=
NULL
;
lua_getfield
(
p_state
,
t
+
2
,
"path"
);
if
(
lua_isstring
(
p_state
,
t
+
3
)
)
{
psz_url
=
lua_tostring
(
p_state
,
t
+
3
);
msg_Dbg
(
p_demux
,
"Path: %s"
,
psz_url
);
const
char
*
psz_path
=
NULL
;
const
char
*
psz_name
=
NULL
;
char
**
ppsz_options
=
NULL
;
int
i_options
=
0
;
/* Read path and name */
psz_path
=
lua_tostring
(
p_state
,
t
+
3
);
msg_Dbg
(
p_demux
,
"Path: %s"
,
psz_path
);
lua_getfield
(
p_state
,
t
+
2
,
"name"
);
if
(
lua_isstring
(
p_state
,
t
+
4
)
)
{
psz_
titl
e
=
lua_tostring
(
p_state
,
t
+
4
);
msg_Dbg
(
p_demux
,
"Name: %s"
,
psz_
titl
e
);
psz_
nam
e
=
lua_tostring
(
p_state
,
t
+
4
);
msg_Dbg
(
p_demux
,
"Name: %s"
,
psz_
nam
e
);
}
else
{
psz_
title
=
psz_url
;
psz_
name
=
psz_path
;
}
p_input
=
input_ItemNewExt
(
p_playlist
,
psz_url
,
psz_title
,
0
,
NULL
,
-
1
);
p_input
->
p_meta
=
vlc_meta_New
();
#define TRY_META( a, b ) \
lua_getfield( p_state, t+2, a ); \
if( lua_isstring( p_state, t+5 ) ) \
{ \
psz_title = lua_tostring( p_state, t+5 ); \
msg_Dbg( p_demux, #b ": %s", psz_title ); \
vlc_meta_Set ## b ( p_input->p_meta, psz_title ); \
} \
/* Read options */
lua_getfield
(
p_state
,
t
+
2
,
"options"
);
if
(
lua_istable
(
p_state
,
t
+
5
)
)
{
lua_pushnil
(
p_state
);
while
(
lua_next
(
p_state
,
t
+
5
)
)
{
if
(
lua_isstring
(
p_state
,
t
+
7
)
)
{
char
*
psz_option
=
strdup
(
lua_tostring
(
p_state
,
t
+
7
)
);
msg_Dbg
(
p_demux
,
"Option: %s"
,
psz_option
);
INSERT_ELEM
(
ppsz_options
,
i_options
,
i_options
,
psz_option
);
}
else
{
msg_Warn
(
p_demux
,
"Option should be a string"
);
}
lua_pop
(
p_state
,
1
);
/* pop option */
}
}
lua_pop
(
p_state
,
1
);
/* pop "options" */
/* Create input item */
p_input
=
input_ItemNewExt
(
p_playlist
,
psz_path
,
psz_name
,
i_options
,
(
const
char
**
)
ppsz_options
,
-
1
);
lua_pop
(
p_state
,
1
);
/* pop "name" */
/* Read meta data */
p_input
->
p_meta
=
vlc_meta_New
();
#define TRY_META( a, b ) \
lua_getfield( p_state, t+2, a ); \
if( lua_isstring( p_state, t+4 ) ) \
{ \
psz_name = lua_tostring( p_state, t+4 ); \
msg_Dbg( p_demux, #b ": %s", psz_name ); \
vlc_meta_Set ## b ( p_input->p_meta, psz_name ); \
} \
lua_pop( p_state, 1 );
/* pop a */
TRY_META
(
"title"
,
Title
);
TRY_META
(
"artist"
,
Artist
);
...
...
@@ -520,12 +556,16 @@ static int Demux( demux_t *p_demux )
TRY_META
(
"arturl"
,
ArtURL
);
TRY_META
(
"trackid"
,
TrackID
);
/* Append item to playlist */
playlist_BothAddInput
(
p_playlist
,
p_input
,
p_item_in_category
,
PLAYLIST_APPEND
|
PLAYLIST_SPREPARSE
,
PLAYLIST_END
,
NULL
,
NULL
,
VLC_FALSE
);
lua_pop
(
p_state
,
1
);
/* pop "name" */
while
(
i_options
>
0
)
free
(
ppsz_options
[
--
i_options
]
);
free
(
ppsz_options
);
}
else
{
...
...
@@ -541,7 +581,6 @@ static int Demux( demux_t *p_demux )
lua_pop
(
p_state
,
1
);
/* pop the value, keep the key for
* the next lua_next() call */
}
lua_pop
(
p_state
,
1
);
/* pop the last key */
}
else
{
...
...
share/luaplaylist/README.txt
View file @
add15152
Instructions to code your own VLC Lua playlist script.
$Id$
Examples: See dailymotion.lua, googlevideo.lua, metacafe.lua and youbtube.lua.
Examples: See dailymotion.lua, googlevideo.lua, metacafe.lua, youbtube.lua
and youtube_homepage.lua .
VLC Lua playlist modules should define two functions:
* probe(): returns true if we want to handle the playlist in this script
...
...
@@ -27,6 +28,8 @@ VLC Lua playlist modules should define two functions:
.encodedby: the item's EncodedBy (OPTIONAL, meta data)
.arturl: the item's ArtURL (OPTIONAL, meta data)
.trackid: the item's TrackID (OPTIONAL, meta data)
.options: a list of VLC options (OPTIONAL)
example: .options = { "fullscreen" }
Invalid playlist items will be discarded by VLC.
VLC defines a global vlc object with the following members:
...
...
share/luaplaylist/dailymotion.lua
View file @
add15152
...
...
@@ -4,7 +4,7 @@
function
probe
()
return
vlc
.
access
==
"http"
and
string.match
(
vlc
.
path
,
"dailymotion.com"
)
and
vlc
.
peek
(
9
)
==
"<!DOCTYPE"
and
string.match
(
vlc
.
peek
(
256
),
"<!DOCTYPE.*<title>Video "
)
end
-- Parse function.
...
...
share/luaplaylist/youtube_homepage.lua
View file @
add15152
function
probe
()
return
vlc
.
access
==
"http"
and
(
string.match
(
vlc
.
path
,
"youtube.com/$"
)
or
string.match
(
vlc
.
path
,
"youtube.com/browse"
)
)
return
vlc
.
access
==
"http"
and
(
string.match
(
vlc
.
path
,
"youtube.com/
?
$"
)
or
string.match
(
vlc
.
path
,
"youtube.com/browse"
)
)
end
function
parse
()
...
...
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