Borewit / music-metadata

Stream and file based music metadata parser for node. Supporting a wide range of audio and tag formats.
MIT License
924 stars 91 forks source link

Object `picture.data` will be `undefined` sometime. #673

Closed yutent closed 3 years ago

yutent commented 3 years ago

FilePath: /lib/common/MetadataCollector.ts

 /**
   * Fix some common issues with picture object
   * @param pictureType
   */
  private async postFixPicture(picture: IPicture): Promise<IPicture> {
    if (picture.data.length > 0) {
      if (!picture.format) {
        const fileType = await FileType.fromBuffer(picture.data);
        if (fileType) {
          picture.format = fileType.mime;
        } else {
          return null;
        }
      }

Object picture.data will be undefined sometime.

Borewit commented 3 years ago

Can you provide me with an example @yutent?

yutent commented 3 years ago

Can you provide me with an example @yutent?

This song: xiangyiweiming.flac.zip

image

Borewit commented 3 years ago

The FLAC has in addition to the Vorbis comment header also an APE header, which is non standard. The APEv2 header is corrupt, it has a tagged named as Cover Art (front) with type text-utf8 (normally this is binary).

But I can improve the handling of the error a bit.

yutent commented 3 years ago

The FLAC has in addition to the Vorbis comment header also an APE header, which is non standard. The APEv2 header is corrupt, it has a tagged named as Cover Art (front) with type text-utf8 (normally this is binary).

But I can improve the handling of the error a bit.

Many thanks!