Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trazyn committed Oct 15, 2017
1 parent 6a38496 commit 60df48d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions server/router/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,7 @@ router.get('/song/:id/:name/:artists/:flac?', cache('5 minutes', onlyStatus200),
let data = response.data;

if (data.code !== 200) {
// Search from other source
song = await search(name, artists);

if (!song.src) {
throw data;
}
throw data;
}

song = data.data[0];
Expand All @@ -244,8 +239,18 @@ router.get('/song/:id/:name/:artists/:flac?', cache('5 minutes', onlyStatus200),
md5: song.md5,
bitRate: song.br,
};

if (!song.src) {
throw new Error('No Copyright');
}
} catch (ex) {
error('Failed to get song URL: %O', ex);
try {
// Search from other source
debug('Search: %s, %s', name, artists);
song = await search(name, artists);
} catch (ex) {
error('Failed to get song URL: %O', ex);
}
}

debug('Resolve song: %O', song);
Expand Down

0 comments on commit 60df48d

Please sign in to comment.