SwapnilSoni1999 / spotify-dl

Spotify Downloader and alternative of Spotdl(python) tool made in NodeJS based on youtube-dl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Covers of songs have `EOI missing` (according to ffprobe)

javalsai opened this issue · comments

Describe the bug
Most of the covers of the songs have EOI missing (according to ffprobe), which means that the image is corrupt or didn't finish downloading when being added to the song. This leads to the image not displaying correctly on file managers, music players...

To Reproduce
Steps to reproduce the behavior:

  1. Download any playlist with the spotify-dl cli and most images should be like this.

Expected behavior
Images fine added to the song.

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Arch Linux (5.18.14-arch1-1)
  • Browser Firefox (Mozilla Firefox 103.0)
  • spotify-dl version: 1.0.8

Not sure if it is because of this, but assuming that the cover is a jpg isn't probably a good idea.

const downloadAndSaveCover = async function (uri, filename) {
const writer = fs.createWriteStream(filename);
const cover = await axios.default({
method: 'GET',
url: uri,
responseType: 'stream',
});
cover.data.pipe(writer);
};
const mergeMetadata = async (output, songData) => {
const coverFileName = output.slice(0, output.length - 3) + 'jpg';
let coverURL = songData.cover_url;
if (!coverURL) {
coverURL = Constants.YOUTUBE_SEARCH.GENERIC_IMAGE;
}
await downloadAndSaveCover(coverURL, coverFileName);
const metadata = {
artist: songData.artists,
album: songData.album_name,
title: songData.name,
date: songData.release_date,
attachments: [coverFileName],
};

commented

feel free to give png a try, from memory it had to be a jpg but i could be wrong

@phyzical I see that for audio download you use ffmpeg to make sure of the format, as far as I know ffmpeg also works with images, so I'm giving it a try

Seems to be working, I'll download a full playlist and if it does work I'll open a PR