From 06759c9e58ca2a650a6ce4f6e8ed1ebe399d3e8f Mon Sep 17 00:00:00 2001 From: phyzical <5182053+phyzical@users.noreply.github.com> Date: Thu, 29 Aug 2024 15:16:04 +0800 Subject: [PATCH 1/2] attempt to log the error when ffmpeg fails --- lib/setup.js | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/lib/setup.js b/lib/setup.js index 141d9f0..4f5c9d7 100644 --- a/lib/setup.js +++ b/lib/setup.js @@ -9,38 +9,27 @@ import versionChecker from '../util/version-checker.js'; import { logFailure } from '../util/log-helper.js'; const ffmpegSetup = function (platform_name) { - switch (platform_name) { - case 'win32': { - try { - const ffmpeg_paths = execSync('where ffmpeg'); - if (ffmpeg_paths.includes('Could not find file')) { + try { + switch (platform_name) { + case 'win32': { + if (execSync('where ffmpeg').includes('Could not find file')) { process.env.PATH = path.resolve(__dirname, 'bin;') + process.env.PATH; } break; - } catch (err) { - logFailure("Couldn't find ffmpeg. Please install https://ffmpeg.org"); } - break; - } - case 'linux': - case 'android': - case 'darwin': - try { - const ffmpeg_paths = execSync('which ffmpeg'); - if (ffmpeg_paths == null) { - logFailure( - "ERROR: Cannot find ffmpeg! Install it first, \ - why don't you read README.md on git!" - ); - process.exit(-1); - } else { + case 'linux': + case 'android': + case 'darwin': + if (execSync('which ffmpeg')) { execSync('export FFMPEG_PATH=$(which ffmpeg)'); + } else { + process.exit(-1); } - break; - } catch (error) { - logFailure("Couldn't find ffmpeg. Please install https://ffmpeg.org"); - } + } + } catch (err) { + logFailure(`Couldn't find ffmpeg. Please install https://ffmpeg.org (Error:${err.message})`); + process.exit(-1); } }; @@ -289,7 +278,7 @@ export function cliInputs() { alias: 'oft', default: flagsConfig.outputFileType, type: 'string', - choices: ['mp3','flac', 'wav', 'aac'], + choices: ['mp3', 'flac', 'wav', 'aac'], helpText: [ '--output-file-type or --oft', '* lets you decide what type of file to output as', From e8332e279411b19a52bae25531572e57264812a0 Mon Sep 17 00:00:00 2001 From: phyzical <5182053+phyzical@users.noreply.github.com> Date: Thu, 29 Aug 2024 15:17:15 +0800 Subject: [PATCH 2/2] bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3ba0cf3..2bcb98b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@swapnilsoni1999/spotify-dl", "productName": "Spotify Downloader", - "version": "1.2.5", + "version": "1.2.6", "description": "Spotify Songs, Playlist & Album Downloader", "main": "app.js", "bin": {