diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2022-07-21 00:44:31 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2022-07-21 00:44:31 +0200 |
| commit | 318fd2fda65e6a0a329a5fad5be3f81d54ccacff (patch) | |
| tree | 936fdce042372b3a97a3256e560af79b773868a5 /player.go | |
| download | WRMS-318fd2fda65e6a0a329a5fad5be3f81d54ccacff.tar.gz WRMS-318fd2fda65e6a0a329a5fad5be3f81d54ccacff.zip | |
initial WIP commit
Diffstat (limited to 'player.go')
| -rw-r--r-- | player.go | 35 |
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() { +} |
