mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2025-01-16 11:15:33 +00:00
Updated spotify plugin to work with new system
This commit is contained in:
parent
ffba5ae7bb
commit
2d58f931b2
|
@ -516,13 +516,6 @@ class Downloader {
|
||||||
|
|
||||||
async downloadWrapper(extraData, track){
|
async downloadWrapper(extraData, track){
|
||||||
const { trackAPI } = extraData
|
const { trackAPI } = extraData
|
||||||
/*
|
|
||||||
if (trackAPI_gw._EXTRA_TRACK){
|
|
||||||
extraData.trackAPI = {...trackAPI_gw._EXTRA_TRACK}
|
|
||||||
delete extraData.trackAPI_gw._EXTRA_TRACK
|
|
||||||
delete trackAPI_gw._EXTRA_TRACK
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// Temp metadata to generate logs
|
// Temp metadata to generate logs
|
||||||
let itemData = {
|
let itemData = {
|
||||||
id: trackAPI.id,
|
id: trackAPI.id,
|
||||||
|
|
|
@ -168,7 +168,7 @@ class Spotify extends Plugin {
|
||||||
explicit: playlistAPI.explicit,
|
explicit: playlistAPI.explicit,
|
||||||
size: tracklist.length,
|
size: tracklist.length,
|
||||||
collection: {
|
collection: {
|
||||||
tracks_gw: [],
|
tracks: [],
|
||||||
playlistAPI: playlistAPI
|
playlistAPI: playlistAPI
|
||||||
},
|
},
|
||||||
plugin: 'spotify',
|
plugin: 'spotify',
|
||||||
|
@ -267,27 +267,8 @@ 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)
|
||||||
}
|
}
|
||||||
|
trackAPI.position = pos+1
|
||||||
let deezerTrack
|
collection[pos] = trackAPI
|
||||||
if (!trackAPI){
|
|
||||||
deezerTrack = {
|
|
||||||
SNG_ID: "0",
|
|
||||||
SNG_TITLE: track.name,
|
|
||||||
DURATION: 0,
|
|
||||||
MD5_ORIGIN: 0,
|
|
||||||
MEDIA_VERSION: 0,
|
|
||||||
FILESIZE: 0,
|
|
||||||
ALB_TITLE: track.album.name,
|
|
||||||
ALB_PICTURE: "",
|
|
||||||
ART_ID: 0,
|
|
||||||
ART_NAME: track.artists[0].name
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
deezerTrack = await dz.gw.get_track_with_fallback(trackAPI.id)
|
|
||||||
}
|
|
||||||
deezerTrack._EXTRA_TRACK = trackAPI
|
|
||||||
deezerTrack.POSITION = pos+1
|
|
||||||
collection[pos] = deezerTrack
|
|
||||||
|
|
||||||
conversionNext += (1 / downloadObject.size) * 100
|
conversionNext += (1 / downloadObject.size) * 100
|
||||||
if (Math.round(conversionNext) != conversion && Math.round(conversionNext) % 2 == 0){
|
if (Math.round(conversionNext) != conversion && Math.round(conversionNext) % 2 == 0){
|
||||||
|
@ -302,7 +283,7 @@ class Spotify extends Plugin {
|
||||||
|
|
||||||
await q.drain()
|
await q.drain()
|
||||||
|
|
||||||
downloadObject.collection.tracks_gw = collection
|
downloadObject.collection.tracks = collection
|
||||||
downloadObject.size = collection.length
|
downloadObject.size = collection.length
|
||||||
downloadObject = new Collection(downloadObject.toDict())
|
downloadObject = new Collection(downloadObject.toDict())
|
||||||
if (listener) listener.send("finishConversion", downloadObject.getSlimmedDict())
|
if (listener) listener.send("finishConversion", downloadObject.getSlimmedDict())
|
||||||
|
|
Loading…
Reference in a new issue