aboutsummaryrefslogtreecommitdiff
path: root/dummyBackend.go
blob: f2eae5724d123c8340125e38bb5f9a63e43ec5cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
}