quick fixes and code cleanup

This commit is contained in:
RemixDev 2021-12-23 19:02:14 +01:00
parent c70898c5d0
commit 3d2965d0f6
No known key found for this signature in database
GPG key ID: B33962B465BDB51C
3 changed files with 22 additions and 5 deletions

View file

@ -129,7 +129,7 @@ async function getPreferredBitrate(dz, track, preferredBitrate, shouldFallback,
} }
if (track.localTrack) { if (track.localTrack) {
let url = await getCorrectURL(track, "MP3_MISC", TrackFormats.LOCAL) let url = await getCorrectURL(track, "MP3_MISC", TrackFormats.LOCAL, feelingLucky)
track.urls["MP3_MISC"] = url track.urls["MP3_MISC"] = url
return TrackFormats.LOCAL return TrackFormats.LOCAL
} }
@ -205,7 +205,7 @@ async function getPreferredBitrate(dz, track, preferredBitrate, shouldFallback,
} }
} }
if (is360Format) throw new TrackNot360 if (is360Format) throw new TrackNot360
let url = await getCorrectURL(track, "MP3_MISC", TrackFormats.DEFAULT) let url = await getCorrectURL(track, "MP3_MISC", TrackFormats.DEFAULT, feelingLucky)
track.urls["MP3_MISC"] = url track.urls["MP3_MISC"] = url
return TrackFormats.DEFAULT return TrackFormats.DEFAULT
} }

View file

@ -125,8 +125,6 @@ async function generateAlbumItem(dz, id, bitrate, rootArtist){
collection.push(trackAPI) collection.push(trackAPI)
}) })
let explicit = albumAPI.explicit_lyrics
return new Collection({ return new Collection({
type: 'album', type: 'album',
id: id, id: id,
@ -134,7 +132,7 @@ async function generateAlbumItem(dz, id, bitrate, rootArtist){
title: albumAPI.title, title: albumAPI.title,
artist: albumAPI.artist.name, artist: albumAPI.artist.name,
cover: cover, cover: cover,
explicit: explicit, explicit: albumAPI.explicit_lyrics,
size: totalSize, size: totalSize,
collection: { collection: {
tracks: collection, tracks: collection,

View file

@ -267,6 +267,25 @@ class Spotify extends Plugin {
} }
if (cachedTrack.id !== "0") trackAPI = await dz.api.get_track(cachedTrack.id) if (cachedTrack.id !== "0") trackAPI = await dz.api.get_track(cachedTrack.id)
} }
if (!trackAPI){
trackAPI = {
id: "0",
title: track.name,
duration: 0,
md5_origin: 0,
media_version: 0,
filesizes: {},
album: {
title: track.album.name,
md5_image: ""
},
artist: {
id: 0,
name: track.artists[0].name,
md5_image: ""
}
}
}
trackAPI.position = pos+1 trackAPI.position = pos+1
collection[pos] = trackAPI collection[pos] = trackAPI