Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
2ff13467
Commit
2ff13467
authored
Jan 21, 2014
by
Julien 'Lta' BALLET
Committed by
Jean-Baptiste Kempf
Jan 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement lazy loading in icelast.lua, fix doc
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
648b2bc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
share/lua/sd/README.txt
share/lua/sd/README.txt
+4
-3
share/lua/sd/icecast.lua
share/lua/sd/icecast.lua
+9
-1
No files found.
share/lua/sd/README.txt
View file @
2ff13467
...
...
@@ -27,12 +27,12 @@ VLC Lua SD modules should define two functions:
User defined modules stored in the share/lua/modules/ directory are
available. Read the '
Two pass Initialization section'
available. Read the '
Lazy initialization' section
Available VLC specific Lua modules: input, msg, net, object, sd,
strings, variables, stream, gettext, xml. See lua/README.txt.
##
Two pass
Initialization
##
Lazy
Initialization
SD Lua scripts are actually ran in two different contexts/interpreters. One of
them is the one that will call your main() and search() functions. The other one
...
...
@@ -51,8 +51,9 @@ lazily_loaded = false
dkjson = nil
function lazy_load()
if lazily_loaded
~= false
then return nil end
if lazily_loaded then return nil end
dkjson = require("dkjson")
lazily_loaded = true
end
function descriptor()
...
...
share/lua/sd/icecast.lua
View file @
2ff13467
...
...
@@ -19,7 +19,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
require
"simplexml"
lazily_loaded
=
false
function
lazy_load
()
if
lazily_loaded
then
return
nil
end
require
"simplexml"
lazily_loaded
=
true
end
function
descriptor
()
return
{
title
=
"Icecast Radio Directory"
}
...
...
@@ -30,6 +37,7 @@ function dropnil(s)
end
function
main
()
lazy_load
()
local
tree
=
simplexml
.
parse_url
(
"http://dir.xiph.org/yp.xml"
)
for
_
,
station
in
ipairs
(
tree
.
children
)
do
simplexml
.
add_name_maps
(
station
)
...
...
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