We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With Pillow installed, I'm trying to set an artwork with this PNG image: https://1drv.ms/i/s!Aq1PMiDnHe9tk6FFfAZPq36aBZwRIQ?e=ayRcrb
Here is my code:
import music_tag media_path = "/path/to/media" image_path = "/path/to/image" tags = music_tag.load_file(media_path) with open(image_path, 'rb') as img: tags["artwork"] = img.read()
I'm getting this error:
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) Cell In[9], line 2 1 with open(f'data/artists/media/{artist_id}/artwork.png', 'rb') as img: ----> 2 tags["artwork"] = img.read() File ~/Workspace/media-downloader/.venv/lib/python3.11/site-packages/music_tag/file.py:603, in AudioFile.__setitem__(self, norm_key, val) 602 def __setitem__(self, norm_key, val): --> 603 self.set(norm_key, val) File ~/Workspace/media-downloader/.venv/lib/python3.11/site-packages/music_tag/file.py:500, in AudioFile.set(self, norm_key, val, typeless) 497 md_sanitizer = None if typeless else tmap.sanitizer 499 if not isinstance(val, MetadataItem): --> 500 val = MetadataItem(md_type, md_sanitizer, val) 502 if hasattr(tmap.setter, '__call__'): 503 tmap.setter(self, norm_key, val) File ~/Workspace/media-downloader/.venv/lib/python3.11/site-packages/music_tag/file.py:67, in MetadataItem.__init__(self, typ, sanitizer, val) 65 self.type = typ 66 self.sanitizer = sanitizer ---> 67 self.values = val File ~/Workspace/media-downloader/.venv/lib/python3.11/site-packages/music_tag/file.py:92, in MetadataItem.values(self, val) 90 v = self.sanitizer(v) 91 if not (self.type is None or v is None or isinstance(v, self.type)): ---> 92 v = self.type(v) 93 self._values[i] = v File ~/Workspace/media-downloader/.venv/lib/python3.11/site-packages/music_tag/file.py:187, in Artwork.__init__(self, raw, width, height, fmt, depth, pic_type) 184 fmt = img.format.lower() 185 mode2depth = {'1': 1, 'L': 8, 'P': 8, 'RGB': 24, 'RGBA': 32, 186 'CMYK': 32, 'YCbCr': 24, 'I': 32, 'F': 32} --> 187 depth = mode2depth[img.mode] 188 except ImportError: 189 width = None KeyError: 'LA'
Looks like some PNG modes are unsupported.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
With Pillow installed, I'm trying to set an artwork with this PNG image: https://1drv.ms/i/s!Aq1PMiDnHe9tk6FFfAZPq36aBZwRIQ?e=ayRcrb
Here is my code:
I'm getting this error:
Looks like some PNG modes are unsupported.
The text was updated successfully, but these errors were encountered: