aboutsummaryrefslogtreecommitdiff
path: root/player.go
diff options
context:
space:
mode:
Diffstat (limited to 'player.go')
-rw-r--r--player.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/player.go b/player.go
new file mode 100644
index 0000000..73b5441
--- /dev/null
+++ b/player.go
@@ -0,0 +1,35 @@
+package main
+
+import (
+ "log"
+)
+
+type Backend interface {
+ Play(song Song)
+ Pause()
+ Search(keyword string) []Song
+}
+
+type Player struct {
+ Backends map[string]Backend
+}
+
+func NewPlayer() Player {
+ available_backends := map[string]Backend{}
+
+ spotify, err := NewSpotify()
+ if err != nil {
+ // log.Fatalln("Error during initialization of the spotify backend:", err.Error())
+ log.Println("Error during initialization of the spotify backend:", err.Error())
+ }
+ available_backends["spotify"] = spotify
+
+ return Player{available_backends}
+}
+
+func (player *Player) Play(song Song) {
+ player.Backends[song.Source].Play(song)
+}
+
+func (player *Player) Pause() {
+}