diff --git a/README.md b/README.md index c66b688..2cc02b7 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,7 @@ bitrate: 160 # Playback bitrate (96, 160, 320) volume_steps: 100 # Volume steps count initial_volume: 100 # Initial volume in steps (not applied to the mixer device) external_volume: false # Whether volume is controlled externally +disable_autoplay: false # Whether autoplay of more songs should be disabled ``` Make sure to check [here](/config_schema.json) for the full list of options. diff --git a/cmd/daemon/controls.go b/cmd/daemon/controls.go index b1d9742..3edc3c4 100644 --- a/cmd/daemon/controls.go +++ b/cmd/daemon/controls.go @@ -530,7 +530,7 @@ func (p *AppPlayer) advanceNext(forceNext, drop bool) (bool, error) { p.state.player.Timestamp = time.Now().UnixMilli() p.state.player.PositionAsOfTimestamp = 0 - if !hasNextTrack && p.prodInfo.AutoplayEnabled() { + if !hasNextTrack && !p.app.cfg.DisableAutoplay { p.state.player.Suppressions = &connectpb.Suppressions{} var prevTrackUris []string diff --git a/cmd/daemon/main.go b/cmd/daemon/main.go index 3ed8abe..0d08904 100644 --- a/cmd/daemon/main.go +++ b/cmd/daemon/main.go @@ -367,6 +367,7 @@ type Config struct { NormalisationPregain float32 `koanf:"normalisation_pregain"` ExternalVolume bool `koanf:"external_volume"` ZeroconfEnabled bool `koanf:"zeroconf_enabled"` + DisableAutoplay bool `koanf:"disable_autoplay"` Server struct { Enabled bool `koanf:"enabled"` Address string `koanf:"address"` diff --git a/cmd/daemon/player.go b/cmd/daemon/player.go index fe0e9b8..c37c886 100644 --- a/cmd/daemon/player.go +++ b/cmd/daemon/player.go @@ -59,7 +59,6 @@ func (p *AppPlayer) handleAccesspointPacket(pktType ap.PacketType, payload []byt } p.prodInfo = &prod - log.Debugf("autoplay enabled: %t", p.prodInfo.AutoplayEnabled()) return nil case ap.PacketTypeCountryCode: *p.countryCode = string(payload) diff --git a/cmd/daemon/product_info.go b/cmd/daemon/product_info.go index 7ae8e87..adfef6f 100644 --- a/cmd/daemon/product_info.go +++ b/cmd/daemon/product_info.go @@ -12,14 +12,9 @@ type ProductInfo struct { Type string `xml:"type"` HeadFilesUrl string `xml:"head-files-url"` ImageUrl string `xml:"image-url"` - Autoplay string `xml:"autoplay"` } `xml:"product"` } func (pi ProductInfo) ImageUrl(fileId string) string { return strings.Replace(pi.Products[0].ImageUrl, "{file_id}", strings.ToLower(fileId), 1) } - -func (pi ProductInfo) AutoplayEnabled() bool { - return pi.Products[0].Autoplay == "1" -} diff --git a/config_schema.json b/config_schema.json index e9ca2e6..271bda2 100644 --- a/config_schema.json +++ b/config_schema.json @@ -201,6 +201,11 @@ "type": "boolean", "description": "Whether volume is controlled externally, if true the app will not pre-multiply samples", "default": false + }, + "disable_autoplay": { + "type": "boolean", + "description": "Whether autoplay of more songs should be disabled", + "default": false } }, "required": [