add config setting for save queue to server
This commit is contained in:
+10
-2
@@ -11,6 +11,7 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||||
"github.com/dweymouth/supersonic/backend/player"
|
"github.com/dweymouth/supersonic/backend/player"
|
||||||
"github.com/dweymouth/supersonic/backend/player/mpv"
|
"github.com/dweymouth/supersonic/backend/player/mpv"
|
||||||
"github.com/dweymouth/supersonic/backend/util"
|
"github.com/dweymouth/supersonic/backend/util"
|
||||||
@@ -305,7 +306,13 @@ func (a *App) Shutdown() {
|
|||||||
a.MPRISHandler.Shutdown()
|
a.MPRISHandler.Shutdown()
|
||||||
a.PlaybackManager.DisableCallbacks()
|
a.PlaybackManager.DisableCallbacks()
|
||||||
if a.Config.Application.SavePlayQueue {
|
if a.Config.Application.SavePlayQueue {
|
||||||
SavePlayQueue(a.ServerManager.ServerID.String(), a.PlaybackManager, configdir.LocalConfig(a.appName, savedQueueFile), nil)
|
var queueServer mediaprovider.CanSavePlayQueue = nil
|
||||||
|
if a.Config.Application.SaveQueueToServer {
|
||||||
|
if qs, ok := a.ServerManager.Server.(mediaprovider.CanSavePlayQueue); ok {
|
||||||
|
queueServer = qs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SavePlayQueue(a.ServerManager.ServerID.String(), a.PlaybackManager, configdir.LocalConfig(a.appName, savedQueueFile), queueServer)
|
||||||
}
|
}
|
||||||
a.PlaybackManager.Stop() // will trigger scrobble check
|
a.PlaybackManager.Stop() // will trigger scrobble check
|
||||||
a.Config.LocalPlayback.Volume = a.LocalPlayer.GetVolume()
|
a.Config.LocalPlayback.Volume = a.LocalPlayer.GetVolume()
|
||||||
@@ -316,7 +323,8 @@ func (a *App) Shutdown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) LoadSavedPlayQueue() error {
|
func (a *App) LoadSavedPlayQueue() error {
|
||||||
queue, err := LoadPlayQueue(configdir.LocalConfig(a.appName, savedQueueFile), a.ServerManager, false)
|
queueFilePath := configdir.LocalConfig(a.appName, savedQueueFile)
|
||||||
|
queue, err := LoadPlayQueue(queueFilePath, a.ServerManager, a.Config.Application.SaveQueueToServer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -42,6 +42,7 @@ type AppConfig struct {
|
|||||||
AllowMultiInstance bool
|
AllowMultiInstance bool
|
||||||
MaxImageCacheSizeMB int
|
MaxImageCacheSizeMB int
|
||||||
SavePlayQueue bool
|
SavePlayQueue bool
|
||||||
|
SaveQueueToServer bool
|
||||||
DefaultPlaylistID string
|
DefaultPlaylistID string
|
||||||
ShowTrackChangeNotification bool
|
ShowTrackChangeNotification bool
|
||||||
|
|
||||||
@@ -155,7 +156,8 @@ func DefaultConfig(appVersionTag string) *Config {
|
|||||||
AllowMultiInstance: false,
|
AllowMultiInstance: false,
|
||||||
MaxImageCacheSizeMB: 50,
|
MaxImageCacheSizeMB: 50,
|
||||||
UIScaleSize: "Normal",
|
UIScaleSize: "Normal",
|
||||||
SavePlayQueue: false,
|
SavePlayQueue: true,
|
||||||
|
SaveQueueToServer: false,
|
||||||
ShowTrackChangeNotification: false,
|
ShowTrackChangeNotification: false,
|
||||||
},
|
},
|
||||||
AlbumPage: AlbumPageConfig{
|
AlbumPage: AlbumPageConfig{
|
||||||
|
|||||||
Reference in New Issue
Block a user