Commit 09a26d40 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

lua: use vlc.strings.url_parse()

parent 4aa188ca
......@@ -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.
......
......@@ -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"]
......
......@@ -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
......
......@@ -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("")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment