diff --git a/libs.js b/libs.js index 9c90e7a..d75734e 100644 --- a/libs.js +++ b/libs.js @@ -30,7 +30,7 @@ const saveSong = (values, callback) => { .exec(function (err, last) { if (err || last.length === 0 || - (last[0] !== undefined && last[0].id !== values.id) + (last[0] !== undefined && last[0].stringId !== values.stringId) ) { console.log(config.colors.FgBlue, '[INFO][saveSong] song not found:', values.title, values.artist, config.colors.Reset) @@ -119,7 +119,7 @@ const getRemoteCover = (song, callback) => { */ const findCover = (song, callback) => { mongo.Metadata.findOne({ - id: song.id + stringId: song.stringId }) .exec((err, metadata) => { if (err) { @@ -180,7 +180,8 @@ const getStream = (callback) => { title: _body.data[0].track.title, album: _body.data[0].track.album, royaltytrackid: _body.data[0].track.royaltytrackid, - id: _body.data[0].track.id || `FAKEID_${_body.data[0].track.artist}_${_body.data[0].track.title}_${_body.data[0].track.album}`, + id: _body.data[0].track.id, + stringId: _body.data[0].track.id || `FAKEID_${_body.data[0].track.artist}_${_body.data[0].track.title}_${_body.data[0].track.album}`, playlistId: _body.data[0].track.playlist ? _body.data[0].track.playlist.id : null, thumbCover: _body.data[0].track.imageurl } diff --git a/mongo.js b/mongo.js index 841f3ef..6059d70 100644 --- a/mongo.js +++ b/mongo.js @@ -8,7 +8,8 @@ const schemas = { title: String, album: String, royaltytrackid: Number, - id: String, + id: Number, + stringId: String, playlistId: Number, thumbCover: String, createdAt: {