KristoforMaynard / music-tag

Simple interface to edit audio file metadata
MIT License
125 stars 19 forks source link

Error occured only on Windows #24

Closed sti1l-0 closed 2 years ago

sti1l-0 commented 3 years ago

Error occured when adding an artwork to a m4a file on Windows, however, it's success on macOS and Linux.

failed on my project on windows image test with code

import music_tag
a = music_tag.load_file(r'E:\Users\Documents\GitHub\ASoulMP3maker\a.m4a')
a['artwork'] = open(r'E:\Users\Documents\GitHub\ASoulMP3maker\j.jpg','rb').read()
a.save()

error info on window

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\17374\AppData\Local\Programs\Python\Python39\lib\site-packages\music_tag\file.py", line 603, in __setitem__
    self.set(norm_key, val)
  File "C:\Users\17374\AppData\Local\Programs\Python\Python39\lib\site-packages\music_tag\file.py", line 503, in set
    tmap.setter(self, norm_key, val)
  File "C:\Users\17374\AppData\Local\Programs\Python\Python39\lib\site-packages\music_tag\mp4.py", line 99, in set_artwork
    raise TypeError('mp4 artwork should be either jpeg or png')
TypeError: mp4 artwork should be either jpeg or png

success on linux image

Here is the m4a file i wanna edit.

musicfile.zip

sti1l-0 commented 3 years ago

fixed when i try pip install pillow. Maybe you should add PIL into your setup.py/install_requires