Prevent unknown albums (YouTube videos) from erroring out

This commit is contained in:
MeowcaTheoRange 2024-02-21 14:30:28 -06:00
parent 2b8a8fde1b
commit aad0030191

View file

@ -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);
}