mpd-mpris: panic on parse-duration when no duration given

I recently wanted to listen to some SID (C64 Music) files and downloaded the whole library here. MPD can decode them by compiling with --enable-sidplay with the liblibsidplayfp package (on Arch Linux), and enabling the decoder in the conf:

decoder {
	plugin			"sidplay"
	songlength_database	"/home/stephen/Music/C64Music/DOCUMENTS/Songlengths.txt"
	default_songlength	"120"
	filter 			"true"
}

When running mpd-mpris when playing a sid file, the following error occurs:

panic: Parse duration: strconv.ParseFloat: parsing "": invalid syntax

goroutine 1 [running]:
github.com/natsukagami/mpd-mpris.(*Player).properties(0xc420098120, 0xc42014e000)
        /tmp/yaytmp-1000/mpd-mpris/src/build/src/github.com/natsukagami/mpd-mpris/player.go:208 +0x14be
github.com/natsukagami/mpd-mpris.NewInstance(0xc4200a41e0, 0x3, 0xc420094240, 0xe)
        /tmp/yaytmp-1000/mpd-mpris/src/build/src/github.com/natsukagami/mpd-mpris/instance.go:50 +0x25c
main.main()
        /tmp/yaytmp-1000/mpd-mpris/src/build/src/github.com/natsukagami/mpd-mpris/cmd/mpd-mpris/main.go:43 +0x14e

When playing stops and mpd-mpris is run, this error occurs:

2018/08/18 18:49:01 strconv.Atoi: parsing "": invalid syntax
github.com/natsukagami/mpd-mpris/mpd.StatusFromAttrs
        /tmp/yaytmp-1000/mpd-mpris/src/build/src/github.com/natsukagami/mpd-mpris/mpd/status.go:40
github.com/natsukagami/mpd-mpris/mpd.(*Client).Status
        /tmp/yaytmp-1000/mpd-mpris/src/build/src/github.com/natsukagami/mpd-mpris/mpd/client.go:156
github.com/natsukagami/mpd-mpris.(*Player).properties
        /tmp/yaytmp-1000/mpd-mpris/src/build/src/github.com/natsukagami/mpd-mpris/player.go:183
github.com/natsukagami/mpd-mpris.NewInstance
        /tmp/yaytmp-1000/mpd-mpris/src/build/src/github.com/natsukagami/mpd-mpris/instance.go:50
main.main
        /tmp/yaytmp-1000/mpd-mpris/src/build/src/github.com/natsukagami/mpd-mpris/cmd/mpd-mpris/main.go:43
runtime.main
        /usr/lib/go/src/runtime/proc.go:198
runtime.goexit
        /usr/lib/go/src/runtime/asm_amd64.s:2361

When switching to a SID file, this error repeats:

2018/08/18 18:44:09 Parse duration: strconv.ParseFloat: parsing "": invalid syntax

I believe this is due to SID files not having a built in length, rather mpd parses the lengths from Songlengths.txt and prints “-:–” as its time.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

Sorry I didn’t have time to test, thanks for the update!