eonpatapon / mpDris2

MPRIS V2.1 support for mpd
GNU General Public License v3.0
210 stars 46 forks source link

Add mp4 cover art support #151

Closed lilyinstarlight closed 2 years ago

lilyinstarlight commented 2 years ago

This PR adds MP4 cover art support based on the mutagen docs for MP4 tags. It assumes the first cover art (if any) is the front cover and instantiates its own mutagen.id3.APIC since the MP4 API doesn't provide one and _create_temp_cover expects one

Let me know if anything is problematic or should be changed!

grawity commented 2 years ago

Looks okay; I wonder if both OGG and MP4 could be folded into the existing for tag in song.tags.keys() loop though.

lilyinstarlight commented 2 years ago

Looks okay; I wonder if both OGG and MP4 could be folded into the existing for tag in song.tags.keys() loop though.

Were you thinking something like this https://github.com/lilyinstarlight/mpDris2/commit/4d1a50fa3a8d5bc0f9d1834884193cf868ab6b4e? I haven't tested the code yet, but if it looks like what you're wanting I can test and PR that later

grawity commented 2 years ago

Looks okay; I wonder if both OGG and MP4 could be folded into the existing for tag in song.tags.keys() loop though.

Were you thinking something like this lilyinstarlight@4d1a50f? I haven't tested the code yet, but if it looks like what you're wanting I can test and PR that later

Yes, something like that.

(If I remember right, looping over all keys was the only way to find mutagen's weirdly-named APIC tags in MP3... so might as well use the same loop for other types too, even if it's not as nice as a direct get().)