Sagi Dayan
92e3c4ea7d
All checks were successful
ci / check for spelling errors (pull_request) Successful in 21s
ci / code quality (lint/tests) (pull_request) Successful in 2m29s
ci / Make sure build does not fail (pull_request) Successful in 2m25s
ci / notify-fail (pull_request) Has been skipped
ci / check for spelling errors (push) Successful in 22s
ci / code quality (lint/tests) (push) Successful in 1m53s
ci / Make sure build does not fail (push) Successful in 2m55s
ci / notify-fail (push) Has been skipped
Signed-off-by: Sagi Dayan <sagidayan@gmail.com>
46 lines
1 KiB
Go
46 lines
1 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.dayanhub.com/sagi/subsonic-tui/internal/client"
|
|
"git.dayanhub.com/sagi/subsonic-tui/internal/config"
|
|
"git.dayanhub.com/sagi/subsonic-tui/internal/playback"
|
|
"git.dayanhub.com/sagi/subsonic-tui/internal/tui"
|
|
)
|
|
|
|
func main() {
|
|
defer client.ArtCache.Destroy()
|
|
// Create Client
|
|
subsonicClient := client.NewClient(config.URL())
|
|
|
|
err := subsonicClient.Authenticate(config.Username(), config.Password())
|
|
if err != nil {
|
|
// We need to show Login...
|
|
login := tui.NewLogin()
|
|
|
|
err := login.Run()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
fmt.Println("Trying to login...")
|
|
|
|
subsonicClient = client.NewClient(config.URL())
|
|
|
|
err = subsonicClient.Authenticate(config.Username(), config.Password())
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
// Saving config - will result in adding new defaults to the file
|
|
config.SaveConfig()
|
|
|
|
playbackCtl := playback.NewController(subsonicClient)
|
|
defer playbackCtl.Close()
|
|
|
|
tui := tui.NewPlayer(subsonicClient, playbackCtl)
|
|
if err := tui.Run(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|