[vlc-commits] lua: use vlc.strings.url_parse()
Rémi Denis-Courmont
git at videolan.org
Wed Nov 16 16:29:49 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 16 17:29:10 2016 +0200| [09a26d40407d80a9a3ebe3b61cef24d87f1a9dbd] | committer: Rémi Denis-Courmont
lua: use vlc.strings.url_parse()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=09a26d40407d80a9a3ebe3b61cef24d87f1a9dbd
---
share/lua/README.txt | 8 +++++---
share/lua/extensions/VLSub.lua | 4 ++--
share/lua/intf/modules/host.lua | 2 +-
share/lua/intf/test.lua | 12 ++++++------
4 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/share/lua/README.txt b/share/lua/README.txt
index 48af9c1..d19053a 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -163,9 +163,8 @@ Net
/!\ NB: this namespace is ONLY usable for interfaces and extensions.
---
----------------------------------------------------------------
-net.url_parse( url ): Parse URL. Returns a table with
- fields "protocol", "username", "password", "host", "port", path" and
- "option".
+net.url_parse( url ): Deprecated alias for strings.url_parse().
+ Will be removed in VLC 4.x.
net.listen_tcp( host, port ): Listen to TCP connections. This returns an
object with an accept and an fds method. accept is blocking (Poll on the
fds with the net.POLLIN flag if you want to be non blocking).
@@ -375,6 +374,9 @@ strings.decode_uri( [uri1, [uri2, [...]]] ): Decode a list of URIs. This
strings.encode_uri_component( [uri1, [uri2, [...]]] ): Encode a list of URI
components. This function returns as many variables as it had arguments.
strings.make_uri( path, [scheme] ): Convert a file path to a URI.
+strings.url_parse( url ): Parse URL. Returns a table with
+ fields "protocol", "username", "password", "host", "port", path" and
+ "option".
strings.resolve_xml_special_chars( [str1, [str2, [...]]] ): Resolve XML
special characters in a list of strings. This function returns as many
variables as it had arguments.
diff --git a/share/lua/extensions/VLSub.lua b/share/lua/extensions/VLSub.lua
index 1fdbf86..16c2736 100644
--- a/share/lua/extensions/VLSub.lua
+++ b/share/lua/extensions/VLSub.lua
@@ -1374,7 +1374,7 @@ openSub = {
file.uri = nil;
else
vlc.msg.dbg("[VLSub] Video URI: "..item:uri())
- local parsed_uri = vlc.net.url_parse(item:uri())
+ local parsed_uri = vlc.strings.url_parse(item:uri())
file.uri = item:uri()
file.protocol = parsed_uri["protocol"]
file.path = parsed_uri["path"]
@@ -1937,7 +1937,7 @@ function parse_header(data)
end
function parse_url(url)
- local url_parsed = vlc.net.url_parse(url)
+ local url_parsed = vlc.strings.url_parse(url)
return url_parsed["host"],
url_parsed["path"],
url_parsed["option"]
diff --git a/share/lua/intf/modules/host.lua b/share/lua/intf/modules/host.lua
index 199325e..b0a4983 100644
--- a/share/lua/intf/modules/host.lua
+++ b/share/lua/intf/modules/host.lua
@@ -253,7 +253,7 @@ function host()
if url == "*console" then
h:listen_stdio()
else
- u = vlc.net.url_parse( url )
+ u = vlc.strings.url_parse( url )
h:listen_tcp( u.host, u.port, (u.protocol == "telnet") )
end
end
diff --git a/share/lua/intf/test.lua b/share/lua/intf/test.lua
index 2e5dfd7..aea8bad 100644
--- a/share/lua/intf/test.lua
+++ b/share/lua/intf/test.lua
@@ -21,21 +21,21 @@ vlc.msg.info('configdir: ' .. vlc.config.configdir())
vlc.msg.info('cachedir: ' .. vlc.config.cachedir())
vlc.msg.info('---- Testing net functions ----')
-vlc.msg.info(' * testing vlc.net.url_parse')
+vlc.msg.info(' * testing vlc.strings.url_parse')
vlc.msg.info(' "filename.ext"')
-assert_url(vlc.net.url_parse('file:///filename.ext'), 'file', nil, nil,
+assert_url(vlc.strings.url_parse('file:///filename.ext'), 'file', nil, nil,
nil, 0, '/filename.ext')
vlc.msg.info(' "http://server.org/path/file.ext"')
-assert_url(vlc.net.url_parse('http://server.org/path/file.ext'),
+assert_url(vlc.strings.url_parse('http://server.org/path/file.ext'),
'http', nil, nil, 'server.org', 0, '/path/file.ext')
vlc.msg.info(' "rtmp://server.org:4212/bla.ext"')
-assert_url(vlc.net.url_parse('rtmp://server.org:4212/bla.ext'),
+assert_url(vlc.strings.url_parse('rtmp://server.org:4212/bla.ext'),
'rtmp', nil, nil, 'server.org', 4212, '/bla.ext')
vlc.msg.info(' "ftp://userbla@server.org:4567/bla.ext"')
-assert_url(vlc.net.url_parse('rtmp://userbla@server.org:4567/bla.ext'),
+assert_url(vlc.strings.url_parse('rtmp://userbla@server.org:4567/bla.ext'),
'rtmp', 'userbla', nil, 'server.org', 4567, '/bla.ext')
vlc.msg.info(' "sftp://userbla:Passw0rd@server.org/bla.ext"')
-assert_url(vlc.net.url_parse('sftp://userbla:Passw0rd@server.org/bla.ext'),
+assert_url(vlc.strings.url_parse('sftp://userbla:Passw0rd@server.org/bla.ext'),
'sftp', 'userbla', 'Passw0rd', 'server.org', 0, '/bla.ext')
vlc.msg.info("")
More information about the vlc-commits
mailing list