mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

Doing ID3 APIC with mime type '-->' documentation missing

Open steveliem opened this issue 3 years ago • 5 comments

In the code I detected a similar commentary like in the ID3 specs: There is the possibility to put only a link to the image file by using the 'MIME type' "-->" and having a complete URL instead of picture data.

But I can't find anywhere in the documentation how to implement this in my client code. I need a working example how to do

from mutagen.id3 import ID3, APIC

audio = ID3('music.mp3')
with open('cover.png', 'rb') as albumart:
    audio['APIC'] = APIC(
                      encoding=3,
                      mime='-->',
                      type=3, desc=u'Cover',
                      data=?????????
                    )

audio.save()

with a URL reference from an online artwork jpg or png.

Thanks.

steveliem avatar Nov 03 '20 09:11 steveliem

good question, that not very commonly used I think. data=myurl.encode("ascii") should work

lazka avatar Nov 03 '20 11:11 lazka

good question, that not very commonly used I think. data=myurl.encode("ascii") should work

Thanks for the tip. I've tested the code. There where no error messages from Python but also when I played the resulting MP3 I didn't see any artwork inside. :-)

from mutagen.id3 import ID3, APIC
import logging

logging.basicConfig(level=logging.DEBUG)

myurl = 'http://cdn.imgbin.com/2/9/13/imgbin-phonograph-record-album-cover-mockup-record-sleeve-design-iLirQ5rFK2yjs9Q51GyjTuv2S.jpg'

audio = ID3('music.mp3')
audio['APIC'] = APIC(
                  encoding=3,
                  mime='-->',
                  type=3, desc=u'Cover',
                  data=myurl.encode('ascii')
                )

audio.save()

I also didn't got any debug logs or verbose logs unfortunately.

steveliem avatar Nov 03 '20 13:11 steveliem

You'd need to test with a player where you know for sure loading APIC with remote URL is supported. Actually I think this might be the bigger issue, this feature in general does neither seem widely known nor used.

phw avatar Nov 03 '20 13:11 phw

You'd need to test with a player where you know for sure loading APIC with remote URL is supported. Actually I think this might be the bigger issue, this feature in general does neither seem widely known nor used.

Unfortunately there is not much information to find around this. Most vendors from the big players don't seem to expose these type of details. Even here https://id3.org/id3v2.3.0#URL_link_frames_-_details the documentation is not 100% around the use of APIC and "-->".

It is a very handy feature to have if it was supported. You'll have an idea about where MP3 files are located the moment a user is listening for the first time. Like collecting bread crumbs on the internet.

steveliem avatar Nov 03 '20 14:11 steveliem

It is a very handy feature to have if it was supported. You'll have an idea about where MP3 files are located the moment a user is listening for the first time. Like collecting bread crumbs on the internet.

That might be one reason why no one implemented this :)

lazka avatar Nov 03 '20 18:11 lazka