id3-go
id3-go copied to clipboard
How to get and print Popularimeter frame
I would like to read the Popularimeter frame from a file with id3-go.
This is how the frame looks like when printing with mutagen-inspect
:
$ mutagen-inspect samples/with_popm.mp3 | grep POPM
[email protected]=0 255/255
I would like to read the value (255/255) from the file. As I could not find any documentation, my naive approach is:
popFrame := mp3File.Frame("POPM")
log.Println(popFrame.String())
But when I run this (on a file with and also without a popularimeter tag), I get segmentation faults:
$ ./popm-read samples/with_popm.mp3
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x4ac302]
goroutine 1 [running]:
main.main()
/home/ifischer/src/rivamp/rivamp-dist/id3-go-popm-example/main.go:21 +0xd2
$ ./popm-read samples/without_popm.mp3
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x4ac302]
goroutine 1 [running]:
main.main()
/home/ifischer/src/rivamp/rivamp-dist/id3-go-popm-example/main.go:21 +0xd2
I setup a sample repository containing two sample files (one with, one without popularimeter frame) here: https://github.com/ifischer/id3-go-popm-example