Closed MageJohn closed 7 years ago
Hey! You're absolutely right on all those suggestions, I've implemented them. I hope I split out the function to the right place, and haven't mucked up the code organisation.
Looks good; has it been tested?
I've tested loading a single embedded front cover from an MP3, a FLAC, and an OGG, file, and they all seem to work as expected.
I haven't tested loading the front cover when there are multiple embedded images, though. This is because nobody seems to do it, so it's hard to find test cases. I already had to manually construct a test case for OGG with a single image.
For FLAC and MP3, I expect it to loop through all available pictures and choose the first type 3 image, which is defined as a front cover (https://mutagen.readthedocs.io/en/latest/api/id3.html#mutagen.id3.PictureType). For OGG files, using VorbisComment, I'm not entirely clear how multiple images are supposed to be embedded, so I just load the first METADATA_BLOCK_PICTURE tag and use that. I suppose if there were multiple such tags, it would be good to go through decoding all of them and check which has type 3.
Add support for extracting the album cover from files not using the ID3 tag system, i.e FLAC and OGG. Also hopefully support files with multiple images embedded, though this hasn't been tested.