You've already forked lx-music-desktop
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70b718d372 | ||
|
|
2b5d6f3592 | ||
|
|
8e48d5ba68 | ||
|
|
3cec62d1a9 | ||
|
|
b1650bcbee | ||
|
|
492e3d8965 | ||
|
|
5b612bfa0f | ||
|
|
1f77b3dd4b | ||
|
|
b0d7a53d15 | ||
|
|
c029eccdd3 | ||
|
|
7236f8929c |
17
.github/ISSUE_TEMPLATE/----.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/----.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: 功能请求
|
||||
about: 为这个项目提出一个想法
|
||||
title: 例如:添加xxx功能、优化xxx功能
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**描述您想要的解决方案**
|
||||
简洁明了地描述您要发生的事情。
|
||||
|
||||
**描述您考虑过的替代方案**
|
||||
对您考虑过的所有替代解决方案或功能的简洁明了的描述。
|
||||
|
||||
**其他内容**
|
||||
在此处添加有关功能请求的任何其他上下文或屏幕截图。
|
||||
31
.github/ISSUE_TEMPLATE/--bug.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/--bug.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: 报告Bug
|
||||
about: 创建报告以帮助我们改进
|
||||
title: 例如:音乐无法播放
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**描述错误**
|
||||
清楚简洁地说明错误是什么。
|
||||
|
||||
**重现**
|
||||
重现行为的步骤:
|
||||
1.转到“ ...”
|
||||
2.点击“ ....”
|
||||
3.向下滚动到“ ....”
|
||||
4.看到错误
|
||||
|
||||
**预期行为**
|
||||
对您期望发生的事情的简洁明了的描述。
|
||||
|
||||
**截图**
|
||||
如果适用,请添加屏幕截图以帮助解释您的问题。
|
||||
|
||||
**环境:**
|
||||
-操作系统及版本:[例如:Windows 10 64位 18362.156]
|
||||
-软件安装包及版本:[例如:Windows 64位绿色版 1.0.0]
|
||||
|
||||
**其他内容**
|
||||
在此处添加有关该问题的任何其他上下文。
|
||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -6,6 +6,21 @@ Project versioning adheres to [Semantic Versioning](http://semver.org/).
|
||||
Commit convention is based on [Conventional Commits](http://conventionalcommits.org).
|
||||
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
|
||||
|
||||
## [0.6.2](https://github.com/lyswhut/lx-music-desktop/compare/v0.6.1...v0.6.2) - 2019-10-01
|
||||
|
||||
祝贺祖国成立70周年~!
|
||||
|
||||
#### 新增
|
||||
|
||||
- 新增QQ音乐源歌单
|
||||
|
||||
#### 修复
|
||||
|
||||
- 修正火影皮肤名字
|
||||
- 修复当试听列表为空时,无法切到其他界面的Bug
|
||||
- 修复百度源搜索结果为空时的接口处理Bug
|
||||
- 恢复**酷狗**其他音质播放
|
||||
|
||||
## [0.6.1](https://github.com/lyswhut/lx-music-desktop/compare/v0.6.0...v0.6.1) - 2019-09-28
|
||||
|
||||
### 新增
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lx-music-desktop",
|
||||
"version": "0.6.1",
|
||||
"version": "0.6.2",
|
||||
"description": "一个免费的音乐下载助手",
|
||||
"main": "./dist/electron/main.js",
|
||||
"productName": "lx-music-desktop",
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
### 新增
|
||||
祝贺祖国成立70周年~!
|
||||
|
||||
- 新增试听列表**滚动条位置恢复**设置(可自动恢复到上次离开时的列表滚动位置),本功能默认开启,若不需要可到设置-列表设置将其关闭
|
||||
- 新增 **《海贼王》** 皮肤,喜欢个性化的可以试试~
|
||||
#### 新增
|
||||
|
||||
### 优化
|
||||
- 新增QQ音乐源歌单
|
||||
|
||||
- 新增DNS解析缓存,加快请求速度
|
||||
- 优化代码逻辑,减少软件对系统资源的占用
|
||||
- 优化新版本信息检测,尽量减少弹出版本获取失败弹窗弹出的概率
|
||||
- 优化下拉列表动画效果
|
||||
#### 修复
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复请求超时的逻辑处理Bug,尝试修复请求无法取消导致的正在播放的歌曲与界面显示的信息不一致的问题
|
||||
- 修复其他一些小Bug
|
||||
|
||||
### 移除
|
||||
|
||||
- 移除 `192k` 音质
|
||||
- 移除酷我音源 `ape` 音质,无损推荐 `flac` 格式
|
||||
- 修正火影皮肤名字
|
||||
- 修复当试听列表为空时,无法切到其他界面的Bug
|
||||
- 修复百度源搜索结果为空时的接口处理Bug
|
||||
- 恢复**酷狗**其他音质播放
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
{
|
||||
"version": "0.6.1",
|
||||
"desc": "<h3>新增</h3>\n<ul>\n<li>新增试听列表<strong>滚动条位置恢复</strong>设置(可自动恢复到上次离开时的列表滚动位置),本功能默认开启,若不需要可到设置-列表设置将其关闭</li>\n<li>新增 <strong>《海贼王》</strong> 皮肤,喜欢个性化的可以试试~</li>\n</ul>\n<h3>优化</h3>\n<ul>\n<li>新增DNS解析缓存,加快请求速度</li>\n<li>优化代码逻辑,减少软件对系统资源的占用</li>\n<li>优化新版本信息检测,尽量减少弹出版本获取失败弹窗弹出的概率</li>\n<li>优化下拉列表动画效果</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复请求超时的逻辑处理Bug,尝试修复请求无法取消导致的正在播放的歌曲与界面显示的信息不一致的问题</li>\n<li>修复其他一些小Bug</li>\n</ul>\n<h3>移除</h3>\n<ul>\n<li>移除 <code>192k</code> 音质</li>\n<li>移除酷我音源 <code>ape</code> 音质,无损推荐 <code>flac</code> 格式</li>\n</ul>\n",
|
||||
"version": "0.6.2",
|
||||
"desc": "<p>祝贺祖国成立70周年~!</p>\n<h4>新增</h4>\n<ul>\n<li>新增QQ音乐源歌单</li>\n</ul>\n<h4>修复</h4>\n<ul>\n<li>修正火影皮肤名字</li>\n<li>修复当试听列表为空时,无法切到其他界面的Bug</li>\n<li>修复百度源搜索结果为空时的接口处理Bug</li>\n<li>恢复<strong>酷狗</strong>其他音质播放</li>\n</ul>\n",
|
||||
"history": [
|
||||
{
|
||||
"version": "0.6.1",
|
||||
"desc": "<h3>新增</h3>\n<ul>\n<li>新增试听列表<strong>滚动条位置恢复</strong>设置(可自动恢复到上次离开时的列表滚动位置),本功能默认开启,若不需要可到设置-列表设置将其关闭</li>\n<li>新增 <strong>《海贼王》</strong> 皮肤,喜欢个性化的可以试试~</li>\n</ul>\n<h3>优化</h3>\n<ul>\n<li>新增DNS解析缓存,加快请求速度</li>\n<li>优化代码逻辑,减少软件对系统资源的占用</li>\n<li>优化新版本信息检测,尽量减少弹出版本获取失败弹窗弹出的概率</li>\n<li>优化下拉列表动画效果</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复请求超时的逻辑处理Bug,尝试修复请求无法取消导致的正在播放的歌曲与界面显示的信息不一致的问题</li>\n<li>修复其他一些小Bug</li>\n</ul>\n<h3>移除</h3>\n<ul>\n<li>移除 <code>192k</code> 音质</li>\n<li>移除酷我音源 <code>ape</code> 音质,无损推荐 <code>flac</code> 格式</li>\n</ul>\n"
|
||||
},
|
||||
{
|
||||
"version": "0.6.0",
|
||||
"desc": "<h3>新增</h3>\n<ul>\n<li>新增音乐<strong>聚合搜索</strong>,目前支持酷我、酷狗、百度源搜索</li>\n<li>新增代理功能</li>\n</ul>\n<h3>优化</h3>\n<ul>\n<li>优化从《梦里嫦娥》皮肤切换到其他皮肤时侧栏动画的切换效果</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复试听列表没有歌曲时会显示列表加载中的Bug</li>\n<li>修复切换歌单列表详情时的UI Bug</li>\n</ul>\n"
|
||||
|
||||
@@ -10,6 +10,6 @@ html(lang="cn")
|
||||
//- if htmlWebpackPlugin.options.isProd
|
||||
//- script.
|
||||
//- window.__static = '!{require('path').join(htmlWebpackPlugin.options.__dirname, '/static').replace(/\\/g, '\\\\')}'
|
||||
if !htmlWebpackPlugin.options.browser && htmlWebpackPlugin.options.isProd
|
||||
//- if !htmlWebpackPlugin.options.browser && htmlWebpackPlugin.options.isProd
|
||||
script.
|
||||
window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
|
||||
window.__static = require('path').join(__dirname, '/resources').replace(/\\/g, '\\\\')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@import './colors.less';
|
||||
|
||||
@themes: green, yellow, blue, red, purple, orange, grey, midAutumn, dhHzw;
|
||||
@themes: green, yellow, blue, red, purple, orange, grey, midAutumn, dhHyrz;
|
||||
|
||||
|
||||
// Colors
|
||||
@@ -372,44 +372,44 @@
|
||||
@color-midAutumn-tab-border-top: fadeout(lighten(@color-midAutumn-theme, 5%), 50%);
|
||||
@color-midAutumn-tab-border-bottom: lighten(@color-midAutumn-theme, 5%);
|
||||
|
||||
@color-dhHzw-theme: rgb(87, 144, 167);
|
||||
@color-dhHzw-theme-bgimg: url(../images/hzwbg.jpeg);
|
||||
@color-dhHzw-theme-bgposition: center center;
|
||||
@color-dhHzw-theme-bgsize: auto 100%;
|
||||
@color-dhHzw-theme-hover: fadeout(lighten(@color-dhHzw-theme, 10%), 45%);
|
||||
@color-dhHzw-theme-active: fadeout(lighten(@color-dhHzw-theme, 15%), 60%);
|
||||
@color-dhHzw-theme-font: rgba(67, 118, 148, 0.9);
|
||||
@color-dhHzw-theme-font-label: fadeout(darken(@color-dhHzw-theme, 20%), 20%);
|
||||
@color-dhHzw-theme_2: rgba(255, 255, 255, 0.8);
|
||||
@color-dhHzw-theme_2-background_1: #e9faff;
|
||||
@color-dhHzw-theme_2-background_2: fadeout(@color-dhHzw-theme_2-background_1, 2%);
|
||||
@color-dhHzw-theme_2-hover: fadeout(lighten(@color-dhHzw-theme, 10%), 65%);
|
||||
@color-dhHzw-theme_2-active: fadeout(darken(@color-dhHzw-theme, 5%), 70%);
|
||||
@color-dhHzw-theme_2-font: darken(@color-dhHzw-theme_2, 80%);
|
||||
@color-dhHzw-theme_2-font-label: lighten(@color-dhHzw-theme, 10%);
|
||||
@color-dhHzw-theme_2-line: lighten(@color-dhHzw-theme, 36%);
|
||||
@color-dhHzw-theme-sidebar: rgba(255, 255, 255, .3);
|
||||
@color-dhHzw-btn: fadeout(darken(@color-dhHzw-theme, 5%), 15%);
|
||||
@color-dhHzw-btn-background: fadeout(lighten(@color-dhHzw-theme, 35%), 70%);
|
||||
@color-dhHzw-pagination-background: fadeout(lighten(@color-dhHzw-theme, 45%), 50%);
|
||||
@color-dhHzw-pagination-hover: fadeout(lighten(@color-dhHzw-theme, 10%), 70%);
|
||||
@color-dhHzw-pagination-active: fadeout(darken(@color-dhHzw-theme, 10%), 70%);
|
||||
@color-dhHzw-pagination-select: fadeout(lighten(@color-dhHzw-theme, 10%), 55%);
|
||||
@color-dhHzw-search-form-background: fadeout(lighten(@color-dhHzw-theme, 30%), 20%);
|
||||
@color-dhHzw-search-list-hover: fadeout(darken(@color-dhHzw-theme, 10%), 50%);
|
||||
@color-dhHzw-scrollbar-track: fadeout(@color-dhHzw-theme, 80%);
|
||||
@color-dhHzw-scrollbar-thumb: fadeout(@color-dhHzw-theme, 60%);
|
||||
@color-dhHzw-scrollbar-thumb-hover: fadeout(@color-dhHzw-theme, 40%);
|
||||
@color-dhHzw-player-pic-c1: fadeout(@color-dhHzw-theme_2, 50%);
|
||||
@color-dhHzw-player-pic-c2: darken(@color-dhHzw-theme_2, 30%);
|
||||
@color-dhHzw-player-progress: darken(@color-dhHzw-theme_2, 6%);
|
||||
@color-dhHzw-player-progress-bar1: darken(@color-dhHzw-theme_2, 12%);
|
||||
@color-dhHzw-player-progress-bar2: lighten(@color-dhHzw-theme, 12%);
|
||||
@color-dhHzw-player-status-text: lighten(@color-dhHzw-theme_2-font, 10%);
|
||||
@color-dhHzw-tab-btn-background: fadeout(lighten(@color-dhHzw-theme, 10%), 80%);
|
||||
@color-dhHzw-tab-btn-background-hover: @color-dhHzw-theme_2-hover;
|
||||
@color-dhHzw-tab-border-top: fadeout(lighten(@color-dhHzw-theme, 5%), 50%);
|
||||
@color-dhHzw-tab-border-bottom: lighten(@color-dhHzw-theme, 5%);
|
||||
@color-dhHyrz-theme: rgb(87, 144, 167);
|
||||
@color-dhHyrz-theme-bgimg: url(../images/hzwbg.jpeg);
|
||||
@color-dhHyrz-theme-bgposition: center center;
|
||||
@color-dhHyrz-theme-bgsize: auto 100%;
|
||||
@color-dhHyrz-theme-hover: fadeout(lighten(@color-dhHyrz-theme, 10%), 45%);
|
||||
@color-dhHyrz-theme-active: fadeout(lighten(@color-dhHyrz-theme, 15%), 60%);
|
||||
@color-dhHyrz-theme-font: rgba(67, 118, 148, 0.9);
|
||||
@color-dhHyrz-theme-font-label: fadeout(darken(@color-dhHyrz-theme, 20%), 20%);
|
||||
@color-dhHyrz-theme_2: rgba(255, 255, 255, 0.8);
|
||||
@color-dhHyrz-theme_2-background_1: #e9faff;
|
||||
@color-dhHyrz-theme_2-background_2: fadeout(@color-dhHyrz-theme_2-background_1, 2%);
|
||||
@color-dhHyrz-theme_2-hover: fadeout(lighten(@color-dhHyrz-theme, 10%), 65%);
|
||||
@color-dhHyrz-theme_2-active: fadeout(darken(@color-dhHyrz-theme, 5%), 70%);
|
||||
@color-dhHyrz-theme_2-font: darken(@color-dhHyrz-theme_2, 80%);
|
||||
@color-dhHyrz-theme_2-font-label: lighten(@color-dhHyrz-theme, 10%);
|
||||
@color-dhHyrz-theme_2-line: lighten(@color-dhHyrz-theme, 36%);
|
||||
@color-dhHyrz-theme-sidebar: rgba(255, 255, 255, .3);
|
||||
@color-dhHyrz-btn: fadeout(darken(@color-dhHyrz-theme, 5%), 15%);
|
||||
@color-dhHyrz-btn-background: fadeout(lighten(@color-dhHyrz-theme, 35%), 70%);
|
||||
@color-dhHyrz-pagination-background: fadeout(lighten(@color-dhHyrz-theme, 45%), 50%);
|
||||
@color-dhHyrz-pagination-hover: fadeout(lighten(@color-dhHyrz-theme, 10%), 70%);
|
||||
@color-dhHyrz-pagination-active: fadeout(darken(@color-dhHyrz-theme, 10%), 70%);
|
||||
@color-dhHyrz-pagination-select: fadeout(lighten(@color-dhHyrz-theme, 10%), 55%);
|
||||
@color-dhHyrz-search-form-background: fadeout(lighten(@color-dhHyrz-theme, 30%), 20%);
|
||||
@color-dhHyrz-search-list-hover: fadeout(darken(@color-dhHyrz-theme, 10%), 50%);
|
||||
@color-dhHyrz-scrollbar-track: fadeout(@color-dhHyrz-theme, 80%);
|
||||
@color-dhHyrz-scrollbar-thumb: fadeout(@color-dhHyrz-theme, 60%);
|
||||
@color-dhHyrz-scrollbar-thumb-hover: fadeout(@color-dhHyrz-theme, 40%);
|
||||
@color-dhHyrz-player-pic-c1: fadeout(@color-dhHyrz-theme_2, 50%);
|
||||
@color-dhHyrz-player-pic-c2: darken(@color-dhHyrz-theme_2, 30%);
|
||||
@color-dhHyrz-player-progress: darken(@color-dhHyrz-theme_2, 6%);
|
||||
@color-dhHyrz-player-progress-bar1: darken(@color-dhHyrz-theme_2, 12%);
|
||||
@color-dhHyrz-player-progress-bar2: lighten(@color-dhHyrz-theme, 12%);
|
||||
@color-dhHyrz-player-status-text: lighten(@color-dhHyrz-theme_2-font, 10%);
|
||||
@color-dhHyrz-tab-btn-background: fadeout(lighten(@color-dhHyrz-theme, 10%), 80%);
|
||||
@color-dhHyrz-tab-btn-background-hover: @color-dhHyrz-theme_2-hover;
|
||||
@color-dhHyrz-tab-border-top: fadeout(lighten(@color-dhHyrz-theme, 5%), 50%);
|
||||
@color-dhHyrz-tab-border-bottom: lighten(@color-dhHyrz-theme, 5%);
|
||||
|
||||
|
||||
// Width
|
||||
|
||||
@@ -367,7 +367,7 @@ export default {
|
||||
getPlayType(highQuality, songInfo) {
|
||||
switch (songInfo.source) {
|
||||
case 'wy':
|
||||
case 'kg':
|
||||
// case 'kg':
|
||||
return '128k'
|
||||
}
|
||||
let type = songInfo._types['192k'] ? '192k' : '128k'
|
||||
|
||||
@@ -52,7 +52,7 @@ export default {
|
||||
checkSource(type) {
|
||||
switch (this.musicInfo.source) {
|
||||
case 'wy':
|
||||
case 'kg':
|
||||
// case 'kg':
|
||||
return type == '128k'
|
||||
|
||||
default:
|
||||
|
||||
@@ -20,6 +20,7 @@ const state = {
|
||||
},
|
||||
listDetail: {
|
||||
list: [],
|
||||
desc: null,
|
||||
total: 0,
|
||||
page: 1,
|
||||
limit: 30,
|
||||
@@ -83,12 +84,13 @@ const mutations = {
|
||||
state.list.page = page
|
||||
state.list.key = key
|
||||
},
|
||||
setListDetail(state, { result, key, page }) {
|
||||
setListDetail(state, { result, key, page, desc }) {
|
||||
state.listDetail.list = result.list
|
||||
state.listDetail.total = result.total
|
||||
state.listDetail.limit = result.limit
|
||||
state.listDetail.page = page
|
||||
state.listDetail.key = key
|
||||
state.listDetail.desc = result.desc
|
||||
},
|
||||
setVisibleListDetail(state, bool) {
|
||||
state.isVisibleListDetail = bool
|
||||
|
||||
@@ -6,6 +6,7 @@ import { version } from '../../../package.json'
|
||||
let electronStore = new Store()
|
||||
const setting = updateSetting(electronStore.get('setting'))
|
||||
electronStore.set('setting', setting)
|
||||
process.versions.app = version
|
||||
|
||||
export default {
|
||||
themes: [
|
||||
@@ -51,8 +52,8 @@ export default {
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: '海贝戎王',
|
||||
class: 'dhHzw',
|
||||
name: '木叶之村',
|
||||
class: 'dhHyrz',
|
||||
},
|
||||
],
|
||||
version: {
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
handleResult(rawData) {
|
||||
let ids = new Set()
|
||||
const list = []
|
||||
if (!rawData) return list
|
||||
rawData.forEach(item => {
|
||||
if (ids.has(item.song_id)) return
|
||||
ids.add(item.song_id)
|
||||
|
||||
@@ -2,6 +2,8 @@ import leaderboard from './leaderboard'
|
||||
import api_source from '../api-source'
|
||||
import songList from './songList'
|
||||
import musicSearch from './musicSearch'
|
||||
import pic from './pic'
|
||||
import lyric from './lyric'
|
||||
|
||||
const kg = {
|
||||
leaderboard,
|
||||
@@ -11,11 +13,17 @@ const kg = {
|
||||
return api_source('kg').getMusicUrl(songInfo, type)
|
||||
},
|
||||
getLyric(songInfo) {
|
||||
return api_source('kg').getLyric(songInfo)
|
||||
return lyric.getLyric(songInfo)
|
||||
},
|
||||
// getLyric(songInfo) {
|
||||
// return api_source('kg').getLyric(songInfo)
|
||||
// },
|
||||
getPic(songInfo) {
|
||||
return api_source('kg').getPic(songInfo)
|
||||
return pic.getPic(songInfo)
|
||||
},
|
||||
// getPic(songInfo) {
|
||||
// return api_source('kg').getPic(songInfo)
|
||||
// },
|
||||
}
|
||||
|
||||
export default kg
|
||||
|
||||
33
src/renderer/utils/music/kg/lyric.js
Normal file
33
src/renderer/utils/music/kg/lyric.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { httpFetch } from '../../request'
|
||||
|
||||
export default {
|
||||
getIntv(interval) {
|
||||
let intvArr = interval.split(':')
|
||||
let intv = 0
|
||||
let unit = 1
|
||||
while (intvArr.length) {
|
||||
intv += (intvArr.pop()) * unit
|
||||
unit *= 60
|
||||
}
|
||||
return parseInt(intv)
|
||||
},
|
||||
getLyric(songInfo, tryNum) {
|
||||
let requestObj = httpFetch(`http://m.kugou.com/app/i/krc.php?cmd=100&keyword=${encodeURIComponent(songInfo.name)}&hash=${songInfo.hash}&timelength=${songInfo._interval || this.getIntv(songInfo.interval)}&d=0.38664927426725626`, {
|
||||
headers: {
|
||||
'KG-RC': 1,
|
||||
'KG-THash': 'expand_search_manager.cpp:852736169:451',
|
||||
'User-Agent': 'KuGou2012-9020-ExpandSearchManager',
|
||||
},
|
||||
})
|
||||
requestObj.promise = requestObj.promise.then(({ body, statusCode }) => {
|
||||
if (statusCode !== 200) {
|
||||
if (tryNum > 5) return Promise.reject('歌词获取失败')
|
||||
let tryRequestObj = this.getLyric(songInfo, tryNum)
|
||||
requestObj.cancelHttp = tryRequestObj.cancelHttp.bind(tryRequestObj)
|
||||
return tryRequestObj.promise
|
||||
}
|
||||
return body
|
||||
})
|
||||
return requestObj
|
||||
},
|
||||
}
|
||||
@@ -57,6 +57,7 @@ export default {
|
||||
songmid: item.audio_id,
|
||||
source: 'kg',
|
||||
interval: formatPlayTime(item.duration),
|
||||
_interval: item.duration,
|
||||
img: null,
|
||||
lrc: null,
|
||||
hash: item.hash,
|
||||
|
||||
44
src/renderer/utils/music/kg/pic.js
Normal file
44
src/renderer/utils/music/kg/pic.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import { httpFetch } from '../../request'
|
||||
|
||||
export default {
|
||||
getPic(songInfo) {
|
||||
const requestObj = httpFetch(
|
||||
'http://media.store.kugou.com/v1/get_res_privilege',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'KG-RC': 1,
|
||||
'KG-THash': 'expand_search_manager.cpp:852736169:451',
|
||||
'User-Agent': 'KuGou2012-9020-ExpandSearchManager',
|
||||
},
|
||||
body: {
|
||||
appid: 1001,
|
||||
area_code: '1',
|
||||
behavior: 'play',
|
||||
clientver: '9020',
|
||||
need_hash_offset: 1,
|
||||
relate: 1,
|
||||
resource: [
|
||||
{
|
||||
album_audio_id: songInfo.songmid,
|
||||
album_id: songInfo.albumId,
|
||||
hash: songInfo.hash,
|
||||
id: 0,
|
||||
name: `${songInfo.singer} - ${songInfo.name}.mp3`,
|
||||
type: 'audio',
|
||||
},
|
||||
],
|
||||
token: '',
|
||||
userid: 2626431536,
|
||||
vip: 1,
|
||||
},
|
||||
}
|
||||
)
|
||||
requestObj.promise = requestObj.promise.then(({ body }) => {
|
||||
if (body.error_code !== 0) return Promise.reject('图片获取失败')
|
||||
let info = body.data[0].info
|
||||
return info.image.replace('{size}', info.imgsize[0])
|
||||
})
|
||||
return requestObj
|
||||
},
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import leaderboard from './leaderboard'
|
||||
import lyric from './lyric'
|
||||
import songList from './songList'
|
||||
import api_source from '../api-source'
|
||||
|
||||
const tx = {
|
||||
leaderboard,
|
||||
songList,
|
||||
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('tx').getMusicUrl(songInfo, type)
|
||||
|
||||
259
src/renderer/utils/music/tx/songList.js
Normal file
259
src/renderer/utils/music/tx/songList.js
Normal file
@@ -0,0 +1,259 @@
|
||||
import { httpFetch } from '../../request'
|
||||
import { formatPlayTime, sizeFormate } from '../../index'
|
||||
|
||||
export default {
|
||||
_requestObj_tags: null,
|
||||
_requestObj_hotTags: null,
|
||||
_requestObj_list: null,
|
||||
_requestObj_listDetail: null,
|
||||
limit_list: 36,
|
||||
limit_song: 10000000,
|
||||
successCode: 0,
|
||||
sortList: [
|
||||
{
|
||||
name: '最热',
|
||||
id: 5,
|
||||
},
|
||||
{
|
||||
name: '最新',
|
||||
id: 2,
|
||||
},
|
||||
],
|
||||
regexps: {
|
||||
hotTagHtml: /class="c_bg_link js_tag_item" data-id="\w+">.+?<\/a>/g,
|
||||
hotTag: /data-id="(\w+)">(.+?)<\/a>/,
|
||||
},
|
||||
tagsUrl: 'https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=wk_v15.json&needNewCode=0&data=%7B%22tags%22%3A%7B%22method%22%3A%22get_all_categories%22%2C%22param%22%3A%7B%22qq%22%3A%22%22%7D%2C%22module%22%3A%22playlist.PlaylistAllCategoriesServer%22%7D%7D',
|
||||
hotTagUrl: 'https://c.y.qq.com/node/pc/wk_v15/category_playlist.html',
|
||||
getListUrl(sortId, id, page) {
|
||||
return id ? `https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=wk_v15.json&needNewCode=0&data=${encodeURIComponent(JSON.stringify({
|
||||
comm: { cv: 1602, ct: 20 },
|
||||
playlist: {
|
||||
method: 'get_category_content',
|
||||
param: {
|
||||
titleid: id,
|
||||
caller: '0',
|
||||
category_id: id,
|
||||
size: this.limit_list,
|
||||
page: page - 1,
|
||||
use_page: page - 1,
|
||||
},
|
||||
module: 'playlist.PlayListCategoryServer',
|
||||
},
|
||||
}))}` : `https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=wk_v15.json&needNewCode=0&data=${encodeURIComponent(JSON.stringify({
|
||||
comm: { cv: 1602, ct: 20 },
|
||||
playlist: {
|
||||
method: 'get_playlist_by_tag',
|
||||
param: { id: 10000000, sin: 0, size: this.limit_list, order: sortId, cur_page: page },
|
||||
module: 'playlist.PlayListPlazaServer',
|
||||
},
|
||||
}))}`
|
||||
},
|
||||
getListDetailUrl(id) {
|
||||
return `https://c.y.qq.com/qzone/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg?type=1&json=1&utf8=1&onlysong=0&new_format=1&disstid=${id}&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0`
|
||||
},
|
||||
|
||||
// http://nplserver.kuwo.cn/pl.svc?op=getlistinfo&pid=2849349915&pn=0&rn=100&encode=utf8&keyset=pl2012&identity=kuwo&pcmp4=1&vipver=MUSIC_9.0.5.0_W1&newver=1
|
||||
// 获取标签
|
||||
getTag() {
|
||||
if (this._requestObj_tags) this._requestObj_tags.cancelHttp()
|
||||
this._requestObj_tags = httpFetch(this.tagsUrl)
|
||||
return this._requestObj_tags.promise.then(({ body }) => {
|
||||
if (body.code !== this.successCode) return this.getTag()
|
||||
return this.filterTagInfo(body.tags.data.v_group)
|
||||
})
|
||||
},
|
||||
// 获取标签
|
||||
getHotTag() {
|
||||
if (this._requestObj_hotTags) this._requestObj_hotTags.cancelHttp()
|
||||
this._requestObj_hotTags = httpFetch(this.hotTagUrl)
|
||||
return this._requestObj_hotTags.promise.then(({ statusCode, body }) => {
|
||||
if (statusCode !== 200) return this.getHotTag()
|
||||
return this.filterInfoHotTag(body)
|
||||
})
|
||||
},
|
||||
filterInfoHotTag(html) {
|
||||
let hotTag = html.match(this.regexps.hotTagHtml)
|
||||
const hotTags = []
|
||||
if (!hotTag) return hotTags
|
||||
|
||||
hotTag.forEach(tagHtml => {
|
||||
let result = tagHtml.match(this.regexps.hotTag)
|
||||
if (!result) return
|
||||
hotTags.push({
|
||||
id: result[1],
|
||||
name: result[2],
|
||||
source: 'tx',
|
||||
})
|
||||
})
|
||||
return hotTags
|
||||
},
|
||||
filterTagInfo(rawList) {
|
||||
return rawList.map(type => ({
|
||||
name: type.group_name,
|
||||
list: type.v_item.map(item => ({
|
||||
parent_id: type.group_id,
|
||||
parent_name: type.group_name,
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
source: 'tx',
|
||||
})),
|
||||
}))
|
||||
},
|
||||
|
||||
// 获取列表数据
|
||||
getList(sortId, tagId, page) {
|
||||
if (this._requestObj_list) this._requestObj_list.cancelHttp()
|
||||
this._requestObj_list = httpFetch(
|
||||
this.getListUrl(sortId, tagId, page)
|
||||
)
|
||||
return this._requestObj_list.promise.then(({ body }) => {
|
||||
if (body.code !== this.successCode) return this.getList(sortId, tagId, page)
|
||||
return tagId ? this.filterList2(body.playlist.data, page) : this.filterList(body.playlist.data, page)
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 格式化播放数量
|
||||
* @param {*} num
|
||||
*/
|
||||
formatPlayCount(num) {
|
||||
if (num > 100000000) return parseInt(num / 10000000) / 10 + '亿'
|
||||
if (num > 10000) return parseInt(num / 1000) / 10 + '万'
|
||||
return num
|
||||
},
|
||||
filterList(data, page) {
|
||||
return {
|
||||
list: data.v_playlist.map(item => ({
|
||||
play_count: this.formatPlayCount(item.access_num),
|
||||
id: item.tid,
|
||||
author: item.creator_info.nick,
|
||||
name: item.title,
|
||||
// time: item.publish_time,
|
||||
img: item.cover_url_medium,
|
||||
// grade: item.favorcnt / 10,
|
||||
desc: item.desc,
|
||||
source: 'tx',
|
||||
})),
|
||||
total: data.total,
|
||||
page,
|
||||
limit: this.limit_list,
|
||||
source: 'tx',
|
||||
}
|
||||
},
|
||||
filterList2({ content }, page) {
|
||||
// console.log(content.v_item)
|
||||
return {
|
||||
list: content.v_item.map(({ basic }) => ({
|
||||
play_count: this.formatPlayCount(basic.play_cnt),
|
||||
id: basic.tid,
|
||||
author: basic.creator.nick,
|
||||
name: basic.title,
|
||||
// time: basic.publish_time,
|
||||
img: basic.cover.medium_url || basic.cover.default_url,
|
||||
// grade: basic.favorcnt / 10,
|
||||
desc: basic.desc.replace(/<br>/g, '\n'),
|
||||
source: 'tx',
|
||||
})),
|
||||
total: content.total_cnt,
|
||||
page,
|
||||
limit: this.limit_list,
|
||||
source: 'tx',
|
||||
}
|
||||
},
|
||||
|
||||
// 获取歌曲列表内的音乐
|
||||
getListDetail(id) {
|
||||
if (this._requestObj_listDetail) {
|
||||
this._requestObj_listDetail.cancelHttp()
|
||||
}
|
||||
this._requestObj_listDetail = httpFetch(this.getListDetailUrl(id), {
|
||||
headers: {
|
||||
Origin: 'https://y.qq.com',
|
||||
Referer: `https://y.qq.com/n/yqq/playsquare/${id}.html`,
|
||||
},
|
||||
})
|
||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
||||
if (body.code !== this.successCode) return this.getListDetail(id)
|
||||
const cdlist = body.cdlist[0]
|
||||
return {
|
||||
list: this.filterListDetail(cdlist.songlist),
|
||||
page: 1,
|
||||
limit: cdlist.songlist.length + 1,
|
||||
total: cdlist.songlist.length,
|
||||
desc: cdlist.desc.replace(/<br>/g, '\n'),
|
||||
source: 'tx',
|
||||
}
|
||||
})
|
||||
},
|
||||
getSinger(singers) {
|
||||
let arr = []
|
||||
singers.forEach(singer => {
|
||||
arr.push(singer.name)
|
||||
})
|
||||
return arr.join('、')
|
||||
},
|
||||
filterListDetail(rawList) {
|
||||
// console.log(rawList)
|
||||
return rawList.map(item => {
|
||||
let types = []
|
||||
let _types = {}
|
||||
if (item.file.size_128mp3 !== 0) {
|
||||
let size = sizeFormate(item.file.size_128mp3)
|
||||
types.push({ type: '128k', size })
|
||||
_types['128k'] = {
|
||||
size,
|
||||
}
|
||||
}
|
||||
if (item.file.size_320mp3 !== 0) {
|
||||
let size = sizeFormate(item.file.size_320mp3)
|
||||
types.push({ type: '320k', size })
|
||||
_types['320k'] = {
|
||||
size,
|
||||
}
|
||||
}
|
||||
if (item.file.size_ape !== 0) {
|
||||
let size = sizeFormate(item.file.size_ape)
|
||||
types.push({ type: 'ape', size })
|
||||
_types.ape = {
|
||||
size,
|
||||
}
|
||||
}
|
||||
if (item.file.size_flac !== 0) {
|
||||
let size = sizeFormate(item.file.size_flac)
|
||||
types.push({ type: 'flac', size })
|
||||
_types.flac = {
|
||||
size,
|
||||
}
|
||||
}
|
||||
// types.reverse()
|
||||
return {
|
||||
singer: this.getSinger(item.singer),
|
||||
name: item.title,
|
||||
albumName: item.album.title,
|
||||
albumId: item.album.mid,
|
||||
source: 'tx',
|
||||
interval: formatPlayTime(item.interval),
|
||||
songId: item.id,
|
||||
albumMid: item.album.mid,
|
||||
strMediaMid: item.file.media_mid,
|
||||
songmid: item.mid,
|
||||
img: (item.album.name === '' || item.album.name === '空')
|
||||
? `https://y.gtimg.cn/music/photo_new/T001R500x500M000${item.singer[0].mid}.jpg`
|
||||
: `https://y.gtimg.cn/music/photo_new/T002R500x500M000${item.album.mid}.jpg`,
|
||||
lrc: null,
|
||||
types,
|
||||
_types,
|
||||
typeUrl: {},
|
||||
}
|
||||
})
|
||||
},
|
||||
getTags() {
|
||||
return Promise.all([this.getTag(), this.getHotTag()]).then(([tags, hotTag]) => ({ tags, hotTag }))
|
||||
},
|
||||
}
|
||||
|
||||
// getList
|
||||
// getTags
|
||||
// getListDetail
|
||||
@@ -7,7 +7,7 @@
|
||||
const types = ['flac', 'ape', '320k', '192k', '128k']
|
||||
export const getMusicType = (info, type) => {
|
||||
switch (window.globalObj.apiSource) {
|
||||
case 'kg':
|
||||
// case 'kg':
|
||||
case 'wy':
|
||||
return '128k'
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ const fetchData = (url, method, {
|
||||
let s = Buffer.from(bHh, 'hex').toString()
|
||||
s = s.replace(s.substr(-1), '')
|
||||
s = Buffer.from(s, 'base64').toString()
|
||||
headers[s] = !!s
|
||||
headers[s] = !s || parseInt(process.versions.app.split('.').map(n => n.length < 3 ? n.padStart(3, '0') : n).join(''))
|
||||
delete headers[bHh]
|
||||
}
|
||||
return request(url, {
|
||||
|
||||
@@ -117,7 +117,7 @@ export default {
|
||||
},
|
||||
handleAddDownloadMultiple(type) {
|
||||
switch (this.source) {
|
||||
case 'kg':
|
||||
// case 'kg':
|
||||
case 'wy':
|
||||
type = '128k'
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
// }
|
||||
// },
|
||||
beforeRouteLeave(to, from, next) {
|
||||
this.routeLeaveLocation = this.$refs.dom_scrollContent.scrollTop
|
||||
this.routeLeaveLocation = (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0
|
||||
next()
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
span(:class="$style.playNum" v-if="selectListInfo.play_count") {{selectListInfo.play_count}}
|
||||
div(:class="$style.songListHeaderMiddle")
|
||||
h3(:title="selectListInfo.name") {{selectListInfo.name}}
|
||||
p(:title="selectListInfo.desc") {{selectListInfo.desc}}
|
||||
p(:title="selectListInfo.desc") {{listDetail.desc || selectListInfo.desc}}
|
||||
div(:class="$style.songListHeaderRight")
|
||||
material-btn(:class="$style.closeDetailButton" @click="hideListDetail") 返回
|
||||
material-song-list(v-model="selectdData" @action="handleSongListAction" :source="source" :page="listDetail.page" :limit="listDetail.limit" :total="listDetail.total" :list="listDetail.list")
|
||||
@@ -191,7 +191,7 @@ export default {
|
||||
},
|
||||
handleAddDownloadMultiple(type) {
|
||||
switch (this.source) {
|
||||
case 'kg':
|
||||
// case 'kg':
|
||||
case 'wy':
|
||||
type = '128k'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user