fix: cloudpan music playing error (#812)

This commit is contained in:
Vidocq 2021-06-30 22:26:54 +08:00 committed by GitHub
parent daadad7bf3
commit 89d346b2ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,10 @@ async function deleteExcessCache() {
export function cacheTrackSource(trackInfo, url, bitRate, from = 'netease') {
const name = trackInfo.name;
const artist = trackInfo.ar[0]?.name || trackInfo.artists[0]?.name;
const artist =
(trackInfo.ar && trackInfo.ar[0]?.name) ||
(trackInfo.artists && trackInfo.artists[0]?.name) ||
'Unknown';
let cover = trackInfo.al.picUrl;
if (cover.slice(0, 5) !== 'https') {
cover = 'https' + cover.slice(4);