Initial commit. Currently can get POST to and print response from /getMusicDirectory
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
build/
|
6
README.rst
Normal file
6
README.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
libremsonic
|
||||
===========
|
||||
|
||||
A *sonic client for the Librem 5.
|
||||
|
||||
Built using Vala, LibSoup, and GTK+.
|
9
meson.build
Normal file
9
meson.build
Normal file
@@ -0,0 +1,9 @@
|
||||
project('libremsonic', 'vala', 'c')
|
||||
|
||||
glib_dep = dependency('glib-2.0')
|
||||
gobject_dep = dependency('gobject-2.0')
|
||||
libsoup_dep = dependency('libsoup-2.4')
|
||||
|
||||
executable('libremsonic', 'src/main.vala',
|
||||
dependencies : [glib_dep, gobject_dep,
|
||||
libsoup_dep])
|
31
src/main.vala
Normal file
31
src/main.vala
Normal file
@@ -0,0 +1,31 @@
|
||||
using Soup;
|
||||
|
||||
int main(string[] args) {
|
||||
|
||||
string url = "http://%s:%s/libresonic/rest/getMusicDirectory".printf(args[1], args[2]);
|
||||
var session = new Soup.Session();
|
||||
var message = new Soup.Message("POST", url);
|
||||
var form = Soup.Form.encode("u", args[3],
|
||||
"p", args[4],
|
||||
"c", "curl_zsh",
|
||||
"f", "json",
|
||||
"v", "1.14.0",
|
||||
"id", args[5]);
|
||||
|
||||
stdout.printf("Form: %s\n", form);
|
||||
|
||||
session.ssl_strict = false;
|
||||
|
||||
message.request_headers.set_content_type(Soup.FORM_MIME_TYPE_URLENCODED, null);
|
||||
message.request_body.append_take(form.data);
|
||||
|
||||
session.send_message(message);
|
||||
|
||||
|
||||
stdout.printf("Status Code: %u\n", message.status_code);
|
||||
stdout.printf("Message length: %lld\n", message.response_body.length);
|
||||
stdout.printf("Data: \n%s\n", (string) message.response_body.data);
|
||||
//stdout.printf("%s\n", message.tls_errors.to_string());
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user