vitiko98 / qobuz-dl

A complete Lossless and Hi-Res music downloader for Qobuz
GNU General Public License v3.0
1.38k stars 183 forks source link

ValueError: None needs to be str for key 'COMPOSER' #171

Open BurkhalterY opened 1 year ago

BurkhalterY commented 1 year ago

The composer field is set to null for the track 3 of this album : https://play.qobuz.com/album/0825646055173

I've checked this in the API : https://www.qobuz.com/api.json/0.2/album/get?album_id=0825646055173&app_id=<your app_id>

The error comes from line 132 of metadata.py :

try:
    audio["COMPOSER"] = d["composer"]["name"]  # COMPOSER
except KeyError:
    pass

PS. Sorry for my bad English 🙂

BurkhalterY commented 1 year ago

The error is only on the FLAC, not the MP3.

sagittarius06 commented 1 year ago

I also have this type of error.

Traceback (most recent call last):
  File "/home/pascal/.local/lib/python3.10/site-packages/qobuz_dl/downloader.py", line 228, in _download_and_tag
    tag_function(
  File "/home/pascal/.local/lib/python3.10/site-packages/qobuz_dl/metadata.py", line 165, in tag_flac
    audio.save()
  File "/usr/lib/python3.10/site-packages/mutagen/_util.py", line 184, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/mutagen/_util.py", line 155, in wrapper
    return func(self, h, *args, **kwargs)
  File "/usr/lib/python3.10/site-packages/mutagen/flac.py", line 850, in save
    self._save(filething, self.metadata_blocks, deleteid3, padding)
  File "/usr/lib/python3.10/site-packages/mutagen/flac.py", line 866, in _save
    data = MetadataBlock._writeblocks(
  File "/usr/lib/python3.10/site-packages/mutagen/flac.py", line 153, in _writeblocks
    data += cls._writeblock(block)
  File "/usr/lib/python3.10/site-packages/mutagen/flac.py", line 125, in _writeblock
    datum = block.write()
  File "/usr/lib/python3.10/site-packages/mutagen/flac.py", line 356, in write
    return super(VCFLACDict, self).write(framing=framing)
  File "/usr/lib/python3.10/site-packages/mutagen/_vorbis.py", line 177, in write
    self.validate()
  File "/usr/lib/python3.10/site-packages/mutagen/_vorbis.py", line 157, in validate
    raise ValueError(err)
ValueError: None needs to be str for key `'COMPOSER'

And so the tmp files are not renamed and are erased.