python - mutagen: how to detect and embed album art in mp3, flac and mp4 -
I want to find out if album art is embedded in an audio file and if not, then want to add album art That file is using the mutation 1) Is the album art finding out? Is there a simpler method than this pseudo code: from mutagen import File audio = file ('music.ext') Each audio pic, audio ['covr'] and audio ['apic:'] if no one raises the exception and nobody If not, then we found the album art 2) I found this album to be embedded in an MP3 file: How do I download albums in other formats? Can I embed art? Edit: Embed MP3 audio = mp3 (filename) data = open (album, rb ') .read () covr = [] if albumart ('MP4Cover.FORMAT_PNG) Code> embed flac: mutagen.flac import file From, file, FLAC DEP add_flac_cover (filename, album) audio = file (file name) image = image () image.type = 3 if albumart.endswith ('png'): Mime = 'image / png' else: mime = 'Image / jpeg' image.desc = 'front As security cover with the ope...