limit MPV in-memory cache size and make it configurable
This commit is contained in:
+3
-1
@@ -80,7 +80,9 @@ func (a *App) readConfig() {
|
||||
|
||||
func (a *App) initMPV() error {
|
||||
p := player.NewWithClientName(AppName)
|
||||
if err := p.Init(a.Config.LocalPlayback.AudioExclusive); err != nil {
|
||||
c := a.Config.LocalPlayback
|
||||
c.InMemoryCacheSizeMB = clamp(c.InMemoryCacheSizeMB, 10, 500)
|
||||
if err := p.Init(c.AudioExclusive, c.InMemoryCacheSizeMB); err != nil {
|
||||
return fmt.Errorf("failed to initialize mpv player: %s", err.Error())
|
||||
}
|
||||
a.Player = p
|
||||
|
||||
+6
-4
@@ -48,8 +48,9 @@ type PlaylistPageConfig struct {
|
||||
}
|
||||
|
||||
type LocalPlaybackConfig struct {
|
||||
AudioExclusive bool
|
||||
Volume int
|
||||
AudioExclusive bool
|
||||
InMemoryCacheSizeMB int
|
||||
Volume int
|
||||
}
|
||||
|
||||
type ScrobbleConfig struct {
|
||||
@@ -98,8 +99,9 @@ func DefaultConfig() *Config {
|
||||
TracklistColumns: []string{"Artist", "Album", "Time", "Plays"},
|
||||
},
|
||||
LocalPlayback: LocalPlaybackConfig{
|
||||
AudioExclusive: false,
|
||||
Volume: 100,
|
||||
AudioExclusive: false,
|
||||
InMemoryCacheSizeMB: 30,
|
||||
Volume: 100,
|
||||
},
|
||||
Scrobbling: ScrobbleConfig{
|
||||
Enabled: true,
|
||||
|
||||
Reference in New Issue
Block a user