-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cbd8ba
commit 2cfaa13
Showing
46 changed files
with
618 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "player", | ||
"version": "1.0.20", | ||
"version": "1.0.22", | ||
"author": "sunzongzheng <[email protected]>", | ||
"description": "An electron-vue project", | ||
"license": "CC0-1.0", | ||
|
@@ -65,17 +65,18 @@ | |
"dependencies": { | ||
"@xunlei/vue-context-menu": "^1.0.2", | ||
"axios": "^0.16.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"element-ui": "2.0.0", | ||
"fs": "0.0.1-security", | ||
"install": "^0.10.1", | ||
"jquery": "^3.2.1", | ||
"lodash": "^4.17.4", | ||
"moment": "^2.18.1", | ||
"music-api": "git+https://github.com/sunzongzheng/musicAPI.git", | ||
"music-api": "git+https://github.com/sunzongzheng/musicApi.git", | ||
"npm": "^5.5.1", | ||
"passport-qq": "0.0.3", | ||
"request": "^2.82.0", | ||
"shelljs": "^0.7.8", | ||
"velocity-animate": "^1.5.0", | ||
"vue": "2.3.3", | ||
"vue-electron": "^1.0.6", | ||
"vue-router": "2.5.3", | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import api from 'music-api' | ||
|
||
export default { | ||
...api, | ||
async searchSong(key) { | ||
try { | ||
let data = await api.searchSong(key) | ||
if (data.status) { | ||
data = data.data | ||
// 为了保留 每个平台搜索结果 的排序权重 此处先找出最大长度 | ||
let maxLength = 0 | ||
for (let i in data) { | ||
const len = data[i].songs.length | ||
if (len > maxLength) { | ||
maxLength = len | ||
} | ||
} | ||
const result = [] | ||
for (let i = 0; i < maxLength; i++) { | ||
for (let j in data) { | ||
const cur = data[j].songs[i] | ||
// 如果存在 | ||
if (typeof cur !== 'undefined') { | ||
// 检查是否已存在同名 同歌手 同专辑 则跳过 | ||
if (result.filter(item => { | ||
// 首先判断歌手是不是全等 此处歌手可能有多个 | ||
let art_same = true | ||
item.artists.every((item, index) => { | ||
if (!cur.artists[index] || item.name !== cur.artists[index].name) { | ||
art_same = false | ||
return false | ||
} | ||
return true | ||
}) | ||
return item.name === cur.name && art_same && item.album.name === cur.album.name | ||
}).length) { | ||
continue | ||
} else { | ||
result.push({ | ||
...cur, | ||
source: j | ||
}) | ||
} | ||
} | ||
} | ||
} | ||
return { | ||
status: true, | ||
data: result | ||
} | ||
} else { | ||
return data | ||
} | ||
} catch (e) { | ||
return { | ||
status: false, | ||
msg: e.msg || '搜索失败,请重试', | ||
log: e | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import axios from 'axios' | ||
import api from './api' | ||
|
||
export default { | ||
init(window) { | ||
global.api = api | ||
global.win = window | ||
global.clientApi = axios | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.