fixed favorites tracks loading with local tracks

This commit is contained in:
RemixDev 2021-12-21 17:47:57 +01:00
parent eea20547c6
commit 659fa8895c

View file

@ -2,24 +2,15 @@ const RELEASE_TYPE = ["single", "album", "compile", "ep", "bundle"]
// maps gw-light api user/tracks to standard api
function map_user_track(track){
let art_picture = track.ART_PICTURE
if (!art_picture){
for (let artist of track.ARTISTS){
if (artist.ART_ID == track.ART_ID){
art_picture = artist.ART_PICTURE
break
}
}
}
return {
let result = {
id: track.SNG_ID,
title: track.SNG_TITLE,
link: 'https://www.deezer.com/track/'+track.SNG_ID,
duration: track.DURATION,
rank: track.RANK_SNG,
explicit_lyrics: parseInt(track.EXPLICIT_LYRICS) > 0,
explicit_content_lyrics: track.EXPLICIT_TRACK_CONTENT.EXPLICIT_COVER_STATUS,
explicit_content_cover: track.EXPLICIT_TRACK_CONTENT.EXPLICIT_LYRICS_STATUS,
explicit_lyrics: false,
explicit_content_lyrics: false,
explicit_content_cover: false,
time_add: track.DATE_ADD || track.DATE_FAVORITE,
album: {
id: track.ALB_ID,
@ -36,15 +27,35 @@ function map_user_track(track){
id: track.ART_ID,
name: track.ART_NAME,
picture: 'https://api.deezer.com/artist/'+track.ART_ID+'/image',
picture_small: 'https://e-cdns-images.dzcdn.net/images/artist/'+art_picture+'/56x56-000000-80-0-0.jpg',
picture_medium: 'https://e-cdns-images.dzcdn.net/images/artist/'+art_picture+'/250x250-000000-80-0-0.jpg',
picture_big: 'https://e-cdns-images.dzcdn.net/images/artist/'+art_picture+'/500x500-000000-80-0-0.jpg',
picture_xl: 'https://e-cdns-images.dzcdn.net/images/artist/'+art_picture+'/1000x1000-000000-80-0-0.jpg',
picture_small: null,
picture_medium: null,
picture_big: null,
picture_xl: null,
tracklist: 'https://api.deezer.com/artist/'+track.ART_ID+'/top?limit=50',
type: 'artist'
},
type: 'track'
}
if (parseInt(track.SNG_ID) >= 0){
let art_picture = track.ART_PICTURE
if (!art_picture){
for (let artist of track.ARTISTS){
if (artist.ART_ID == track.ART_ID){
art_picture = artist.ART_PICTURE
break
}
}
}
result.explicit_lyrics = parseInt(track.EXPLICIT_LYRICS) > 0
result.explicit_content_lyrics = track.EXPLICIT_TRACK_CONTENT.EXPLICIT_COVER_STATUS
result.explicit_content_cover = track.EXPLICIT_TRACK_CONTENT.EXPLICIT_LYRICS_STATUS
result.artist.picture_small = 'https://e-cdns-images.dzcdn.net/images/artist/'+art_picture+'/56x56-000000-80-0-0.jpg'
result.artist.picture_medium = 'https://e-cdns-images.dzcdn.net/images/artist/'+art_picture+'/250x250-000000-80-0-0.jpg'
result.artist.picture_big = 'https://e-cdns-images.dzcdn.net/images/artist/'+art_picture+'/500x500-000000-80-0-0.jpg'
result.artist.picture_xl = 'https://e-cdns-images.dzcdn.net/images/artist/'+art_picture+'/1000x1000-000000-80-0-0.jpg'
}
return result
}
// maps gw-light api user/artists to standard api