Some small fixes

This commit is contained in:
RemixDev 2021-04-08 17:25:24 +02:00
parent 8528617e07
commit 23ca85796e
5 changed files with 11 additions and 11 deletions

View file

@ -36,7 +36,7 @@ class API{
} catch (e) {
console.log(e)
await new Promise(r => setTimeout(r, 2000)) // sleep(2000ms)
return await this.api_call(method, args)
return this.api_call(method, args)
}
if (result_json.error){
if (result_json.error.code){

View file

@ -61,7 +61,7 @@ class GW{
}catch (e){
console.log(e)
await new Promise(r => setTimeout(r, 2000)) // sleep(2000ms)
return await this.api_call(method, args, params)
return this.api_call(method, args, params)
}
if (result_json.error.length) throw new GWAPIError(result_json.error)
return result_json.results
@ -367,7 +367,7 @@ class GW{
async get_track_with_fallback(sng_id){
let body
if (int(sng_id) > 0){
if (parseInt(sng_id) > 0){
try{ body = await this.get_track_page(sng_id) }
catch (e) {}
}

View file

@ -8,7 +8,7 @@ function map_user_track(track){
link: 'https://www.deezer.com/track/'+track.SNG_ID,
duration: track.DURATION,
rank: track.RANK_SNG,
explicit_lyrics: int(track.EXPLICIT_LYRICS) > 0,
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,
time_add: track.DATE_ADD,
@ -126,11 +126,11 @@ function map_album(album){
fans: album.RANK,
rating: 0, // TODO: Needs to be checked
release_date: album.PHYSICAL_RELEASE_DATE,
record_type: RELEASE_TYPE[int(album.TYPE)] || "unknown",
record_type: RELEASE_TYPE[parseInt(album.TYPE)] || "unknown",
available: true, // TODO: Needs to be checked
alternative: null, // TODO: Needs to be checked
tracklist: `https://api.deezer.com/album/${album.ALB_ID}/tracks`,
explicit_lyrics: int(album.EXPLICIT_LYRICS) > 0,
explicit_lyrics: parseInt(album.EXPLICIT_LYRICS) > 0,
explicit_content_lyrics: 2, // TODO: Needs to be checked
explicit_content_cover: 2, // TODO: Needs to be checked
contributors: [], // TODO: Needs to be checked
@ -157,9 +157,9 @@ function map_artist_album(album){
genre_id: album.GENRE_ID,
fans: album.RANK,
release_date: album.PHYSICAL_RELEASE_DATE,
record_type: RELEASE_TYPE[int(album.TYPE)] || "unknown",
record_type: RELEASE_TYPE[parseInt(album.TYPE)] || "unknown",
tracklist: `https://api.deezer.com/album/${album.ALB_ID}/tracks`,
explicit_lyrics: int(album.EXPLICIT_LYRICS) > 0,
explicit_lyrics: parseInt(album.EXPLICIT_LYRICS) > 0,
type: album.__TYPE__,
// Extras
nb_tracks: album.NUMBER_TRACK,

4
package-lock.json generated
View file

@ -1,11 +1,11 @@
{
"name": "deezer-js",
"version": "0.0.2",
"version": "0.0.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.0.2",
"version": "0.0.3",
"license": "GPL-3.0-or-later",
"dependencies": {
"got": "^11.8.2",

View file

@ -1,6 +1,6 @@
{
"name": "deezer-js",
"version": "0.0.2",
"version": "0.0.3",
"description": "A wrapper for all Deezer's APIs",
"main": "deezer/index.js",
"scripts": {