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 = { const tags = {
title: trackData.name, title: trackData.name,
artist: trackData.artist.name, artist: trackData.artist.name,
album: trackData.album["#text"], album: trackData.album["#text"] || trackData.name,
APIC: "./cover.png", APIC: "./cover.png",
userDefinedUrl: [{ userDefinedUrl: [{
description: "Last.FM page", description: "Last.FM page",
@ -92,7 +92,7 @@ async function getVideo() {
return { return {
tags, tags,
...selectedVideo, ...selectedVideo,
albumCover: trackData.image.at(-1)["#text"] albumCover: trackData.image?.at(-1)["#text"]
}; };
} }
@ -212,7 +212,7 @@ async function main() {
}) })
let albumCover; let albumCover;
if (!(await checkNextcloudAlbum(video, nextcloudClient))) { if (!(await checkNextcloudAlbum(video, nextcloudClient)) && video.albumCover != null) {
albumCover = await downloadAlbumCover(video); albumCover = await downloadAlbumCover(video);
} }