Prevent unknown albums (YouTube videos) from erroring out
This commit is contained in:
parent
2b8a8fde1b
commit
aad0030191
1 changed files with 3 additions and 3 deletions
6
index.js
6
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue