Skip to content

Commit 4cef92a

Browse files
committed
fix: 云盘提升失败的问题
1 parent 30e8ee3 commit 4cef92a

File tree

5 files changed

+34
-67
lines changed

5 files changed

+34
-67
lines changed

ncmExtend/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<!-- spell-checker: disable -->
22
# 更新日志
33

4+
## 4.2.3
5+
`2024-10-22`
6+
7+
修复
8+
- `云盘音质提升` 导入的歌曲无法提升的问题。
9+
410
## 4.2.2
511
`2024-10-18`
612

ncmExtend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ncmextend",
33
"private": true,
4-
"version": "4.2.2",
4+
"version": "4.2.3",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

ncmExtend/src/components/ncmDownUpload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export class ncmDownUpload {
365365
} else {
366366
console.log(song.title, '完成')
367367
//完成
368-
showTips(`(6/6)${song.title} 上传完成`, 1)
368+
showTips(`${song.title} 上传完成`, 1)
369369
this.uploadSongSuccess(song)
370370
}
371371
}

ncmExtend/src/home/cloudUpgrade.js

Lines changed: 25 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const cloudUpgrade = (uiArea) => {
1717
inputPlaceholder: '选择目标音质',
1818
confirmButtonText: '下一步',
1919
showCloseButton: true,
20-
footer: '寻找网易云音源比云盘音质好的歌曲,然后进行替换<a href="/Cinvin/myuserscripts" target="_blank"><img src="https://img.shields.io/github/stars/cinvin/myuserscripts?style=social" alt="Github"></a>',
20+
footer: '<div>寻找网易云音源比云盘音质好的歌曲,然后进行删除并重新上传</div><div>⚠️可能出现删除了歌曲但上传失败的情况</div><div>部分歌曲无法判断是否能提升</div>',
2121
inputValidator: (value) => {
2222
if (!value) {
2323
return '请选择目标音质'
@@ -186,19 +186,20 @@ width: 16%;
186186
offset: offset,
187187
},
188188
onload: (res) => {
189+
//console.log(res)
189190
upgrader.popupObj.tbody.innerHTML = `正在搜索第${offset + 1}${Math.min(offset + 1000, res.count)}云盘歌曲`
190191
res.data.forEach(song => {
191192
if (song.simpleSong.privilege.toast) return
193+
if (song.simpleSong.privilege.fee == 0 && song.simpleSong.privilege.flLevel == "none") return
192194
if (song.simpleSong.privilege.fee == 4) return
193-
if (song.simpleSong.privilege.playMaxBrLevel != "lossless") return
195+
if (song.simpleSong.privilege.playMaxBrLevel == "none") return
194196
let cloudWeight = levelWeight[song.simpleSong.privilege.plLevel] || 0
195-
let ncmMaxWeight = levelWeight[song.simpleSong.privilege.playMaxBrLevel]
196197
if (cloudWeight >= this.targetWeight) return
197198
songIds.push({ 'id': song.simpleSong.id })
198199
upgrader.popupObj.tbody.innerHTML = `正在搜索第${offset + 1}${Math.min(offset + 1000, res.count)}云盘歌曲 找到${songIds.length}首可能有提升的歌曲`
199200
})
200201
if (res.hasMore) {
201-
//if(offset<2000){//testing
202+
//if (offset < 2000) {//testing
202203
res = {}
203204
upgrader.fetchCloudSongInfoSub(offset + 1000, songIds)
204205
} else {
@@ -239,11 +240,15 @@ width: 16%;
239240
let cloudBr = content.songs[i].pc.br
240241
if (upgrader.targetLevel == 'lossless' && content.songs[i].sq) {
241242
songItem.fileinfo = { originalLevel: content.privileges[j].plLevel, originalBr: content.songs[i].pc.br, tagetBr: Math.round(content.songs[i].sq.br / 1000) }
242-
upgrader.songs.push(songItem)
243+
if(songItem.fileinfo.originalBr+10<=songItem.fileinfo.tagetBr){
244+
upgrader.songs.push(songItem)
245+
}
243246
}
244247
else if (upgrader.targetLevel == 'hires' && content.songs[i].hr) {
245248
songItem.fileinfo = { originalLevel: content.privileges[j].plLevel, originalBr: content.songs[i].pc.br, tagetBr: Math.round(content.songs[i].hr.br / 1000) }
246-
upgrader.songs.push(songItem)
249+
if(songItem.fileinfo.originalBr+10<=songItem.fileinfo.tagetBr){
250+
upgrader.songs.push(songItem)
251+
}
247252
}
248253
break
249254
}
@@ -346,83 +351,38 @@ width: 16%;
346351
let song = this.songs[songIndex]
347352
let upgrade = this
348353
try {
349-
weapiRequest("/api/cloud/user/song/match", {
354+
weapiRequest("/api/cloud/del", {
350355
data: {
351-
songId: song.id,
352-
adjustSongId: 0,
356+
songIds: [song.id],
353357
},
354-
onload: (res) => {
355-
console.log(res)
356-
if (res.code == 200) {
357-
showTips(`${song.name}解绑成功`, 1)
358-
song.originalId = res.matchData.songId
359-
let songItem = { api: { url: '/api/song/enhance/player/url/v1', data: { ids: JSON.stringify([song.id]), level: upgrade.targetLevel, encodeType: 'mp3' } }, id: song.id, title: song.name, artist: song.artists, album: song.album, songIndex: songIndex, Upgrader: this }
360-
let ULobj = new ncmDownUpload([songItem], false, this.onUploadSuccess, this.onUploadFail)
361-
ULobj.startUpload()
362-
} else {
363-
showTips(`${song.name}解绑失败`, 2)
364-
upgrade.onUpgradeFail(songIndex)
358+
onload: (content) => {
359+
console.log(content)
360+
if (content.code == 200) {
361+
showTips(`${song.name}删除成功`, 1)
365362
}
363+
let songItem = { api: { url: '/api/song/enhance/player/url/v1', data: { ids: JSON.stringify([song.id]), level: upgrade.targetLevel, encodeType: 'mp3' } }, id: song.id, title: song.name, artist: song.artists, album: song.album, songIndex: songIndex, Upgrader: this }
364+
let ULobj = new ncmDownUpload([songItem], false, this.onUpgradeSucess, this.onUpgradeFail)
365+
ULobj.startUpload()
366366
},
367367
})
368-
369368
} catch (e) {
370369
console.error(e);
371370
upgrade.onUpgradeFail(songIndex)
372371
}
373372
}
374-
onUploadFail(ULsong) {
375-
let song = ULsong.Upgrader.songs[ULsong.songIndex]
376-
try {
377-
weapiRequest("/api/cloud/user/song/match", {
378-
data: {
379-
songId: song.originalId,
380-
adjustSongId: song.id,
381-
},
382-
onload: (res) => {
383-
console.log(res)
384-
if (res.code != 200) {
385-
showTips(`${song.name} 重新关联失败`, 2)
386-
}
387-
ULsong.Upgrader.onUpgradeFail(ULsong.songIndex)
388-
},
389-
})
390-
391-
} catch (e) {
392-
console.error(e);
393-
ULsong.Upgrader.onUpgradeFail(ULsong.songIndex)
394-
}
395-
}
396-
onUploadSuccess(ULsong) {
373+
onUpgradeFail(ULsong) {
397374
let song = ULsong.Upgrader.songs[ULsong.songIndex]
398-
try {
399-
weapiRequest("/api/cloud/del", {
400-
data: {
401-
songIds: [song.originalId],
402-
},
403-
onload: (responses) => {
404-
ULsong.Upgrader.onUpgradeSucess(ULsong.songIndex)
405-
},
406-
})
407-
408-
} catch (e) {
409-
console.error(e);
410-
ULsong.Upgrader.onUpgradeFail(ULsong.songIndex)
411-
}
412-
}
413-
onUpgradeFail(songIndex) {
414-
let song = this.songs[songIndex]
415375
showTips(`${song.name} 音质提升失败`, 2)
416-
this.onUpgradeFinnsh(songIndex)
376+
ULsong.Upgrader.onUpgradeFinnsh(ULsong.songIndex)
417377
}
418-
onUpgradeSucess(songIndex) {
419-
let song = this.songs[songIndex]
378+
onUpgradeSucess(ULsong) {
379+
let song = ULsong.Upgrader.songs[ULsong.songIndex]
420380
showTips(`${song.name} 音质提升成功`, 1)
421381
song.upgraded = true
422382
let btnUpgrade = song.tablerow.querySelector('button')
423383
btnUpgrade.innerHTML = '已提升'
424384
btnUpgrade.disabled = 'disabled'
425-
this.onUpgradeFinnsh(songIndex)
385+
ULsong.Upgrader.onUpgradeFinnsh(ULsong.songIndex)
426386
}
427387
onUpgradeFinnsh(songIndex) {
428388
if (this.batchUpgrade.working) {

ncmExtend/src/song/songDetail.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class SongDetail {
2323
'/api/song/play/about/block/page': JSON.stringify({ 'songId': this.songId }),
2424
},
2525
onload: (res) => {
26+
console.log(res)
2627
this.SongRes = res
2728
this.dataFetched = true
2829
this.checkStartCreateDom()

0 commit comments

Comments
 (0)