Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit 0db8195

Browse files
author
trazyn
authored
Merge pull request #227 from trazyn/dev
FIx bug
2 parents bc456e8 + 15fd7f8 commit 0db8195

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

server/router/player.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ router.get('/song/:id/:name/:artists/:flac?', cache('3 minutes', onlyStatus200),
199199
// Only accept highquality
200200
} else {
201201
// Try to get the normal quality track
202-
song = await selector.getMp3(name, artists, id);
202+
song = await selector.getTrack(name, artists, id);
203203
}
204204
}
205205
}

server/search/Baidu.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import chalk from 'chalk';
55
const debug = _debug('dev:plugin:Baidu');
66
const error = _debug('dev:plugin:Baidu:error');
77

8-
export default async(request, keyword, artists, isFlac) => {
8+
export default async(request, keyword, artists) => {
99
debug(chalk.black.bgGreen('💊 Loaded Baidu music.'));
1010

1111
try {
@@ -29,7 +29,6 @@ export default async(request, keyword, artists, isFlac) => {
2929
uri: 'http://music.taihe.com/data/music/fmlink',
3030
qs: {
3131
songIds: song.songid,
32-
type: isFlac ? 'flac' : 'mp3',
3332
},
3433
});
3534

@@ -53,10 +52,6 @@ export default async(request, keyword, artists, isFlac) => {
5352
debug(chalk.black.bgGreen('🚚 Result >>>'));
5453
debug(response.data.songList[0]);
5554
debug(chalk.black.bgGreen('🚚 <<<'));
56-
57-
if (isFlac) {
58-
song.isFlac = true;
59-
}
6055
}
6156
} catch (ex) {
6257
// Anti-warnning

server/search/Netease.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export default async(request, keyword, artists, id) => {
3535
bitRate: song.br,
3636
};
3737

38+
if (!song.src) {
39+
return Promise.reject(Error(404));
40+
}
41+
3842
debug(chalk.black.bgGreen('🚚 Result >>>'));
3943
debug(song);
4044
debug(chalk.black.bgGreen('🚚 <<<'));

server/search/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ async function exe(plugins, ...args) {
5050
}
5151

5252
async function getFlac(keyword, artists) {
53-
return exe([Baidu, QQ], keyword, artists, true);
53+
return exe([QQ], keyword, artists, true);
5454
}
5555

56-
async function getMp3(keyword, artists, id /** This id is only work for netease music */) {
56+
async function getTrack(keyword, artists, id /** This id is only work for netease music */) {
5757
var preferences = await getPreferences();
5858
var enginers = preferences.enginers;
5959
var plugins = [Netease];
@@ -98,5 +98,5 @@ async function getMp3(keyword, artists, id /** This id is only work for netease
9898

9999
export {
100100
getFlac,
101-
getMp3,
101+
getTrack,
102102
};

0 commit comments

Comments
 (0)