From aad003019101c74b620bd74c66968e7076db0a4e Mon Sep 17 00:00:00 2001 From: MeowcaTheoRange Date: Wed, 21 Feb 2024 14:30:28 -0600 Subject: [PATCH] Prevent unknown albums (YouTube videos) from erroring out --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 58caa27..c7b2c14 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ async function getVideo() { const tags = { title: trackData.name, artist: trackData.artist.name, - album: trackData.album["#text"], + album: trackData.album["#text"] || trackData.name, APIC: "./cover.png", userDefinedUrl: [{ description: "Last.FM page", @@ -92,7 +92,7 @@ async function getVideo() { return { tags, ...selectedVideo, - albumCover: trackData.image.at(-1)["#text"] + albumCover: trackData.image?.at(-1)["#text"] }; } @@ -212,7 +212,7 @@ async function main() { }) let albumCover; - if (!(await checkNextcloudAlbum(video, nextcloudClient))) { + if (!(await checkNextcloudAlbum(video, nextcloudClient)) && video.albumCover != null) { albumCover = await downloadAlbumCover(video); }