fix coverless album bug tidal, bump version

This commit is contained in:
aria blue
2024-04-13 13:38:09 -04:00
parent a61a24d98a
commit 94c5134af2
2 changed files with 15 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "lucida",
"version": "1.2.8",
"version": "1.2.9",
"description": "A modular music downloader tool",
"main": "build/index.js",
"type": "module",

View File

@@ -9,7 +9,10 @@ export interface RawArtist {
}
export function parseArtist(raw: RawArtist): Artist {
const picturePath = raw?.picture?.replace(/-/gm, '/')
let picturePath
if (raw?.picture != null) picturePath = raw?.picture?.replace(/-/gm, '/')
else picturePath = null
const artist: Artist = {
id: raw.id,
url: raw.url ?? `https://www.tidal.com/artist/${raw.id}`,
@@ -37,12 +40,20 @@ export interface RawAlbum {
}
export function parseAlbum(raw: RawAlbum): Album {
const coverPath = raw.cover.replace(/-/gm, '/')
let coverPath
if (raw.cover) coverPath = raw.cover.replace(/-/gm, '/')
else coverPath = null
const album: Album = {
id: raw.id,
url: raw.url ?? `https://tidal.com/browse/album/${raw.id}`,
title: raw.title,
coverArtwork: [
coverArtwork: []
}
if (coverPath)
album.coverArtwork = [
{
url: `https://resources.tidal.com/images/${coverPath}/160x160.jpg`,
width: 160,
@@ -59,7 +70,6 @@ export function parseAlbum(raw: RawAlbum): Album {
height: 1280
}
]
}
if (raw.upc) album.upc = raw.upc
if (raw.artists) album.artists = raw.artists.map(parseArtist)
if (raw.numberOfTracks) album.trackCount = raw.numberOfTracks