diff options
Diffstat (limited to 'samples/cddb.lua')
-rw-r--r-- | samples/cddb.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/samples/cddb.lua b/samples/cddb.lua index d2e5b59..0ceba09 100644 --- a/samples/cddb.lua +++ b/samples/cddb.lua | |||
@@ -1,4 +1,5 @@ | |||
1 | require"http" | 1 | socket = require("socket") |
2 | http = require("http") | ||
2 | 3 | ||
3 | if not arg or not arg[1] or not arg[2] then | 4 | if not arg or not arg[1] or not arg[2] then |
4 | print("luasocket cddb.lua <category> <disc-id> [<server>]") | 5 | print("luasocket cddb.lua <category> <disc-id> [<server>]") |
@@ -31,7 +32,7 @@ end | |||
31 | local host = socket.dns.gethostname() | 32 | local host = socket.dns.gethostname() |
32 | local query = "%s?cmd=cddb+read+%s+%s&hello=LuaSocket+%s+LuaSocket+2.0&proto=6" | 33 | local query = "%s?cmd=cddb+read+%s+%s&hello=LuaSocket+%s+LuaSocket+2.0&proto=6" |
33 | local url = string.format(query, server, arg[1], arg[2], host) | 34 | local url = string.format(query, server, arg[1], arg[2], host) |
34 | local body, headers, code, error = socket.http.get(url) | 35 | local body, headers, code, error = http.get(url) |
35 | 36 | ||
36 | if code == 200 then | 37 | if code == 200 then |
37 | local data, code, error = parse(body) | 38 | local data, code, error = parse(body) |