add multi-server functionality pt. 2 - delete server

This commit is contained in:
Drew Weymouth
2023-05-17 16:19:24 -07:00
parent 85eb790cd1
commit 4d4b14e4de
8 changed files with 113 additions and 18 deletions
+7
View File
@@ -12,6 +12,7 @@ import (
"github.com/dweymouth/supersonic/backend/util"
"github.com/dweymouth/supersonic/player"
"github.com/dweymouth/supersonic/sharedutil"
"github.com/google/uuid"
"github.com/20after4/configdir"
"github.com/zalando/go-keyring"
@@ -149,6 +150,12 @@ func (a *App) LoginToDefaultServer(string) error {
return a.ServerManager.ConnectToServer(serverCfg, pass)
}
func (a *App) DeleteServerCacheDir(serverID uuid.UUID) error {
path := path.Join(configdir.LocalCache(a.appName), serverID.String())
log.Printf("Deleting server cache dir: %s", path)
return os.RemoveAll(path)
}
func (a *App) Shutdown() {
a.PlaybackManager.DisableCallbacks()
a.Player.Stop() // will trigger scrobble check