aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ping.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/ping.go')
-rw-r--r--cmd/ping.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/cmd/ping.go b/cmd/ping.go
new file mode 100644
index 0000000..a046cb0
--- /dev/null
+++ b/cmd/ping.go
@@ -0,0 +1,31 @@
1package main
2
3import (
4 "bytes"
5 "codesaloon.com/torpedo"
6 "encoding/xml"
7 "fmt"
8 "net/url"
9)
10
11type ping struct {
12 torpedo.PostNotSupported
13 torpedo.PutNotSupported
14 torpedo.DeleteNotSupported
15}
16
17func (ping) Get(values url.Values) (int, string) {
18
19 data := &subsonicresponse{Version: "1.1.1", Status: "ok", Xmlns: "http://subsonic.org/restapi"}
20
21 buf := new(bytes.Buffer)
22 enc := xml.NewEncoder(buf)
23
24 if err := enc.Encode(data); err != nil {
25 fmt.Printf("error: %v\n", err)
26 } else {
27 fmt.Println(buf.String())
28 }
29
30 return 200, buf.String()
31}