dhowden / tag

ID3, MP4 and OGG/FLAC metadata parsing in Go
BSD 2-Clause "Simplified" License
558 stars 73 forks source link

Picture tag is reading as `int` #19

Closed deluan closed 8 years ago

deluan commented 8 years ago

I found a weird problem with this file: https://www.dropbox.com/s/avnkb5hro9g1jgc/05%20Freaky.m4a?dl=0

When trying to get the Picture from it, tag panics trying to convert an int(!!) to *tag.Picture, as you can see in the stack trace:

$ tag ~/Downloads/05\ Freaky.m4a
Metadata Format: MP4
File Type:
 Title: Freaky
 Album: Goddess
 Artist: SOHO
 Composer: SOHO
 Genre: 'lectricPop
 Year: 1990
 Track: 5 of 12
 Disc: 0 of 0
panic: interface conversion: interface {} is int, not *tag.Picture

goroutine 1 [running]:
panic(0x170300, 0xc82000e4c0)
    /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
github.com/dhowden/tag.(*metadataMP4).Picture(0xc82000a460, 0x10)
    <autogenerated>:97 +0x13b
main.printMetadata(0x32b468, 0xc82000a460)
    /Users/deluan/Development/go/src/github.com/dhowden/tag/tag/tag.go:100 +0xbb6
main.main()
    /Users/deluan/Development/go/src/github.com/dhowden/tag/tag/tag.go:56 +0x3d3

My environment:

dhowden commented 8 years ago

I've fixed the panic, but we should be able to get the image from there.

This seems to be being triggered and then the actual picture data ignored: https://github.com/dhowden/tag/blob/master/mp4.go#L156

Will investigate further.