aboutsummaryrefslogtreecommitdiff
path: root/dummyBackend.go
diff options
context:
space:
mode:
Diffstat (limited to 'dummyBackend.go')
-rw-r--r--dummyBackend.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/dummyBackend.go b/dummyBackend.go
new file mode 100644
index 0000000..f2eae57
--- /dev/null
+++ b/dummyBackend.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+ "crypto/sha1"
+ "encoding/base64"
+)
+
+type DummyBackend struct{}
+
+func (dummy *DummyBackend) Play(song Song) {
+}
+
+func (dummy *DummyBackend) Pause() {
+}
+
+func (dummy *DummyBackend) Search(keyword string) []Song {
+
+ s := NewDummySong("Dummy Mc Crashtest", "exactly "+keyword)
+ return []Song{s}
+}
+
+func NewDummySong(title string, artist string) Song {
+ s := Song{title, artist, "dummy", "", 0, 0, map[string]struct{}{}, map[string]struct{}{}}
+ h := sha1.New()
+ h.Write([]byte(title))
+ h.Write([]byte(artist))
+ s.Uri = base64.URLEncoding.EncodeToString(h.Sum(nil))
+ return s
+}