aboutsummaryrefslogtreecommitdiff
path: root/dummyBackend.go
blob: d4461db3c3ae820a32ea9904a6535107e57c2c9b (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
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, artist string) Song {
	h := sha1.New()
	h.Write([]byte(title))
	h.Write([]byte(artist))
	return NewSong(title, artist, "dummy", base64.URLEncoding.EncodeToString(h.Sum(nil)))
}