Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[已解明] 登陆账号后进入音乐库页面程序卡死 #1019

Closed
rainbowflesh opened this issue Oct 28, 2021 · 45 comments · Fixed by #1040, #1135 or #1143
Closed

[已解明] 登陆账号后进入音乐库页面程序卡死 #1019

rainbowflesh opened this issue Oct 28, 2021 · 45 comments · Fixed by #1040, #1135 or #1143

Comments

@rainbowflesh
Copy link
Contributor

win11 上的客户端.

任何方式登录账号, 进入音乐库页面就会卡死, 托盘菜单中右键退出程序, 依然会在后台运行, 且 CPU 占用很高
重置和删用户文件不起作用, 安装版和安装到内存的版本都会出现卡死.

控制台输出一个 POST 请求错误:

http://localhost:27232/api/daily_signin?type=0&timestamp=1635429769199 400 (Bad Request)

完整日志

main.js:25 如出现问题,可尝试在本页输入 resetApp() 然后按回车重置应用。
undefined:1 Failed to load resource: the server responded with a status of 404 (Not Found)
electron/js2c/renderer_init.js:13 (electron) The remote module is deprecated. Use https://github.com/electron/remote instead.
log @ electron/js2c/renderer_init.js:13
(anonymous) @ electron/js2c/renderer_init.js:85
./lib/renderer/api/remote.ts @ electron/js2c/renderer_init.js:85
webpack_require @ electron/js2c/renderer_init.js:1
loader @ electron/js2c/renderer_init.js:77
(anonymous) @ electron/js2c/renderer_init.js:25
(anonymous) @ nativeAlert.js:17
7381 @ nativeAlert.js:14
c @ bootstrap:89
a0b9 @ chunk-4bbc70da.528d9c00.js:1
c @ bootstrap:89
Promise.then (async)
component @ index.js:29
(anonymous) @ vue-router.esm.js:2144
(anonymous) @ vue-router.esm.js:2171
(anonymous) @ vue-router.esm.js:2171
Xt @ vue-router.esm.js:2170
(anonymous) @ vue-router.esm.js:2106
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
r @ vue-router.esm.js:2008
(anonymous) @ vue-router.esm.js:2005
(anonymous) @ vue-router.esm.js:2379
(anonymous) @ Scrollbar.vue:58
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
(anonymous) @ vue-router.esm.js:2005
(anonymous) @ vue-router.esm.js:2379
(anonymous) @ index.js:167
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
r @ vue-router.esm.js:2008
Ft @ vue-router.esm.js:2012
ee.confirmTransition @ vue-router.esm.js:2387
ee.transitionTo @ vue-router.esm.js:2260
e.push @ vue-router.esm.js:2704
(anonymous) @ vue-router.esm.js:3020
we.push @ vue-router.esm.js:3019
xe.a.push @ index.js:144
toLogin @ Navbar.vue:172
re @ vue.runtime.esm.js:1854
n @ vue.runtime.esm.js:2179
i._wrapper @ vue.runtime.esm.js:6917
xhr.js:177 POST http://localhost:27232/api/daily_signin?type=0&timestamp=1635429769199 400 (Bad Request)
(anonymous) @ xhr.js:177
t.exports @ xhr.js:13
t.exports @ dispatchRequest.js:52
Promise.then (async)
u.request @ Axios.js:61
(anonymous) @ bind.js:9
s @ user.js:77
m @ common.js:110
activated @ library.vue:241
re @ vue.runtime.esm.js:1854
Bn @ vue.runtime.esm.js:4219
Fn @ vue.runtime.esm.js:4192
tr @ vue.runtime.esm.js:4370
Qn @ vue.runtime.esm.js:4335
(anonymous) @ vue.runtime.esm.js:1980
le @ vue.runtime.esm.js:1906
Promise.then (async)
ae @ vue.runtime.esm.js:1933
ve @ vue.runtime.esm.js:1990
er @ vue.runtime.esm.js:4402
rr.update @ vue.runtime.esm.js:4544
yt.notify @ vue.runtime.esm.js:730
set @ vue.runtime.esm.js:1055
(anonymous) @ vue-router.esm.js:2989
(anonymous) @ vue-router.esm.js:2988
ee.updateRoute @ vue-router.esm.js:2409
(anonymous) @ vue-router.esm.js:2263
(anonymous) @ vue-router.esm.js:2397
r @ vue-router.esm.js:2001
r @ vue-router.esm.js:2008
Ft @ vue-router.esm.js:2012
(anonymous) @ vue-router.esm.js:2392
r @ vue-router.esm.js:2001
(anonymous) @ vue-router.esm.js:2005
(anonymous) @ vue-router.esm.js:2379
(anonymous) @ vue-router.esm.js:2127
(anonymous) @ vue-router.esm.js:2203
Promise.then (async)
(anonymous) @ vue-router.esm.js:2150
(anonymous) @ vue-router.esm.js:2171
(anonymous) @ vue-router.esm.js:2171
Xt @ vue-router.esm.js:2170
(anonymous) @ vue-router.esm.js:2106
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
r @ vue-router.esm.js:2008
(anonymous) @ vue-router.esm.js:2005
(anonymous) @ vue-router.esm.js:2379
(anonymous) @ Scrollbar.vue:58
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
(anonymous) @ vue-router.esm.js:2005
(anonymous) @ vue-router.esm.js:2379
(anonymous) @ index.js:158
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
r @ vue-router.esm.js:2008
Ft @ vue-router.esm.js:2012
ee.confirmTransition @ vue-router.esm.js:2387
ee.transitionTo @ vue-router.esm.js:2260
e.push @ vue-router.esm.js:2704
(anonymous) @ vue-router.esm.js:3020
we.push @ vue-router.esm.js:3019
xe.a.push @ index.js:144
(anonymous) @ loginAccount.vue:223
Promise.then (async)
(anonymous) @ loginAccount.vue:222
Promise.then (async)
handleLoginResponse @ loginAccount.vue:221
Promise.then (async)
login @ loginAccount.vue:206
re @ vue.runtime.esm.js:1854
n @ vue.runtime.esm.js:2179
i._wrapper @ vue.runtime.esm.js:6917
xhr.js:177 POST http://localhost:27232/api/daily_signin?type=1&timestamp=1635429769199 400 (Bad Request)
(anonymous) @ xhr.js:177
t.exports @ xhr.js:13
t.exports @ dispatchRequest.js:52
Promise.then (async)
u.request @ Axios.js:61
(anonymous) @ bind.js:9
s @ user.js:77
m @ common.js:113
activated @ library.vue:241
re @ vue.runtime.esm.js:1854
Bn @ vue.runtime.esm.js:4219
Fn @ vue.runtime.esm.js:4192
tr @ vue.runtime.esm.js:4370
Qn @ vue.runtime.esm.js:4335
(anonymous) @ vue.runtime.esm.js:1980
le @ vue.runtime.esm.js:1906
Promise.then (async)
ae @ vue.runtime.esm.js:1933
ve @ vue.runtime.esm.js:1990
er @ vue.runtime.esm.js:4402
rr.update @ vue.runtime.esm.js:4544
yt.notify @ vue.runtime.esm.js:730
set @ vue.runtime.esm.js:1055
(anonymous) @ vue-router.esm.js:2989
(anonymous) @ vue-router.esm.js:2988
ee.updateRoute @ vue-router.esm.js:2409
(anonymous) @ vue-router.esm.js:2263
(anonymous) @ vue-router.esm.js:2397
r @ vue-router.esm.js:2001
r @ vue-router.esm.js:2008
Ft @ vue-router.esm.js:2012
(anonymous) @ vue-router.esm.js:2392
r @ vue-router.esm.js:2001
(anonymous) @ vue-router.esm.js:2005
(anonymous) @ vue-router.esm.js:2379
(anonymous) @ vue-router.esm.js:2127
(anonymous) @ vue-router.esm.js:2203
Promise.then (async)
(anonymous) @ vue-router.esm.js:2150
(anonymous) @ vue-router.esm.js:2171
(anonymous) @ vue-router.esm.js:2171
Xt @ vue-router.esm.js:2170
(anonymous) @ vue-router.esm.js:2106
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
r @ vue-router.esm.js:2008
(anonymous) @ vue-router.esm.js:2005
(anonymous) @ vue-router.esm.js:2379
(anonymous) @ Scrollbar.vue:58
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
(anonymous) @ vue-router.esm.js:2005
(anonymous) @ vue-router.esm.js:2379
(anonymous) @ index.js:158
h @ vue-router.esm.js:2357
r @ vue-router.esm.js:2004
r @ vue-router.esm.js:2008
Ft @ vue-router.esm.js:2012
ee.confirmTransition @ vue-router.esm.js:2387
ee.transitionTo @ vue-router.esm.js:2260
e.push @ vue-router.esm.js:2704
(anonymous) @ vue-router.esm.js:3020
we.push @ vue-router.esm.js:3019
xe.a.push @ index.js:144
(anonymous) @ loginAccount.vue:223
Promise.then (async)
(anonymous) @ loginAccount.vue:222
Promise.then (async)
handleLoginResponse @ loginAccount.vue:221
Promise.then (async)
login @ loginAccount.vue:206
re @ vue.runtime.esm.js:1854
n @ vue.runtime.esm.js:2179
i._wrapper @ vue.runtime.esm.js:6917

看上去是自动签到出的问题? 在网易云客户端里显示已签到.
前几天把所有喜欢的音乐和歌单都删了, 当天和第二天是没有问题的, 之后出现把音乐加入歌单后就会卡死, 昨天起打开音乐库就卡死, 暂时不清楚其中的因果.

@65wu
Copy link

65wu commented Oct 28, 2021

同样的问题,win11,cpu占用相当高,偶尔会卡死,但是音乐还会正常播放

@memorydream
Copy link
Collaborator

memorydream commented Oct 28, 2021

会不会是网易云API那边最近有什么更改导致的问题,好像是最近几天才出现的

@rainbowflesh
Copy link
Contributor Author

会不会是网易云API那边最近有什么更改导致的问题,好像是最近几天才出现的

签到还是能签上, 但是因为这个 400 返回没有处理引起了奇怪的 bug.

@CyanWoods
Copy link

mac端也有这个问题,音乐还在播放,界面能够滚动,但是点击无反应,滚动条也是卡死状态。

@Hibanaw
Copy link
Contributor

Hibanaw commented Oct 31, 2021

Linux 端也出现了这个问题

@yitaikarma
Copy link

mac m1 4.2版本 同样问题

@mikaela-khara
Copy link

我win10,遇到了同样问题

@H3artdown
Copy link

win10 同样的问题

@Hibanaw
Copy link
Contributor

Hibanaw commented Nov 3, 2021

签到还是能签上, 但是因为这个 400 返回没有处理引起了奇怪的 bug.

有时间的话还是麻烦大佬修一下这个 bug,还是有些影响使用的,现在都不敢点音乐库

@wyzGitHub
Copy link

win10同样的问题 单文件版0.42 系统20H2
从任务管理器杀死进程后应用退出,但是再打开任务管理器还存在进程 切CPU占用极高

@rainbowflesh
Copy link
Contributor Author

rainbowflesh commented Nov 5, 2021

签到还是能签上, 但是因为这个 400 返回没有处理引起了奇怪的 bug.

有时间的话还是麻烦大佬修一下这个 bug,还是有些影响使用的,现在都不敢点音乐库

理论上用 axios 拦截 400 响应码然后执行一次刷新页面似乎可行, 这周末我处理一下.

编辑:
经过一番调试发现并不是因为接口 400, 是出在加载音乐库页面本身, 暂时没有找到具体出现的原因.

编辑2:
目前认为导致页面卡死的原因是 CSS 里面用了 calc 属性导致的.

编辑3:
calc 属性没有问题, 我查看各接口的响应, 发现歌词接口会出现无限挂起从而导致网页卡住, 我认为是原因所在.

编辑4:
确认 library.vue 里的 getRandomLyric() 方法中

getRandomLyric() {
      if (this.liked.songs.length === 0) return;
      getLyric(
        this.liked.songs[randomNum(0, this.liked.songs.length - 1)]
      ).then(data => {
        if (data.lrc !== undefined) this.lyric = data.lrc.lyric;
      });
    },

if (data.lrc !== undefined) this.lyric = data.lrc.lyric

导致的错误, 似乎是因为 loadData() 里执行了一个看上去很奇怪的判断引起死循环

      if (this.liked.songsWithDetails.length > 0) {
        NProgress.done();
        this.show = true;
        this.$store.dispatch('fetchLikedSongsWithDetails');
        this.getRandomLyric();
      } else {
        this.$store.dispatch('fetchLikedSongsWithDetails').then(() => {
          NProgress.done();
          this.show = true;
          this.getRandomLyric();
        });
      }

把这玩意注释了依然加载歌词, 不影响使用.

@Hibanaw @memorydream 你们有什么头绪么

@memorydream
Copy link
Collaborator

我有一个疑问,这个问题在你的电脑上每次都稳定复现吗?因为在我这里是个低概率事件,只有刚刚我尝试使用release的0.4.2版本时发生过两次(这期间我尝试启动了十几次)
因为这段时间我一直在使用最新的构建而不是release版本,没有发生过这个情况,之前是在修改代码调试的时候,当触发重新编译后出现过几次,所以我对这个bug一直是一个很迷惑的状态

@memorydream
Copy link
Collaborator

memorydream commented Nov 5, 2021

编辑3:
480353
29137871
518546461
437752427
586299
475584898
1474400749

以上为几次卡死时获取的歌词id,启动yesplaymusic后,在浏览器中输入http://localhost:10754/lyric?id=可以查看这些歌词的信息,有点多我就不截图了

观察这些数据,有nolyric: true的,有歌词只有作词作曲被过滤的
只看结果的话就是没有歌词的,大胆猜测这应该就是问题发生的原因了

编辑4:
上面记录了一些卡死时会出现的歌词,但是卡死时不止出现一个歌词,有时候会有两个歌词,一个满足以上推测的卡死条件,一个是有歌词数据的,虽然这应该对结论不造成影响,但也在此说明一下观察到的情况

编辑2:
刚刚重新看了一遍这几张截图,感觉问题可能不是这么简单,还需要确认是否会在有歌词的情况下发生卡死

原文
我想我找到问题了,这是两次卡死获取到的歌词数据
image
image

对照没有卡死的数据
image

看上去确实是wy修改了API返回的数据导致的问题,但是我还需要再多跑出两次卡死来验证这个结果


编辑:
进一步测试的结果:
image
在这个数据上卡死了一次,如果它卡死的原因和上面的两个原因相同的话,那么问题可能在此处同样存在
不过这里比较好修复
image
只要在这之后再判断一次是否有值应该可以解决

@rainbowflesh
Copy link
Contributor Author

rainbowflesh commented Nov 6, 2021

编辑3: 480353 29137871 518546461 437752427 586299 475584898 1474400749

以上为几次卡死时获取的歌词id,启动yesplaymusic后,在浏览器中输入http://localhost:10754/lyric?id=可以查看这些歌词的信息,有点多我就不截图了

观察这些数据,有nolyric: true的,有歌词只有作词作曲被过滤的 只看结果的话就是没有歌词的,大胆猜测这应该就是问题发生的原因了

编辑4: 上面记录了一些卡死时会出现的歌词,但是卡死时不止出现一个歌词,有时候会有两个歌词,一个满足以上推测的卡死条件,一个是有歌词数据的,虽然这应该对结论不造成影响,但也在此说明一下观察到的情况

编辑2: 刚刚重新看了一遍这几张截图,感觉问题可能不是这么简单,还需要确认是否会在有歌词的情况下发生卡死

原文 我想我找到问题了,这是两次卡死获取到的歌词数据 image image

对照没有卡死的数据 image

看上去确实是wy修改了API返回的数据导致的问题,但是我还需要再多跑出两次卡死来验证这个结果

编辑: 进一步测试的结果: image 在这个数据上卡死了一次,如果它卡死的原因和上面的两个原因相同的话,那么问题可能在此处同样存在 不过这里比较好修复 image 只要在这之后再判断一次是否有值应该可以解决

据此, 我测试的时候还发现了如歌曲id 1873048358 出现了只有作曲没有作词的
{"version":1,"lyric":"作曲 : 井上拓\n"}
, 我将尝试重写过滤判断并提交pr.

编辑:
我改了两处判断,

    getRandomLyric() {
      if (this.liked.songs.length === 0) return;
      getLyric(
        this.liked.songs[randomNum(0, this.liked.songs.length - 1)]
      ).then(data => {
        if (data.lrc !== undefined && data.lrc.includes('作词'))
          this.lyric = data.lrc.lyric;
      });
    },

我在此直接判断是否存在值 '作词',

    pickedLyric() {
      if (this.lyric === undefined) return '';
      let lyric = this.lyric.split('\n');
      lyric = lyric.filter(l => {
        if (!l.includes('作词')) {
          return true;
        }
        return false;
      });
...

在 pickedLyric() 里直接过滤掉不含'作词', 在我本机上测试这样是可行的, 请你校对一下逻辑是否可以.

@rainbowflesh rainbowflesh changed the title 登陆账号后进入音乐库页面程序卡死 [已解明] 登陆账号后进入音乐库页面程序卡死 Nov 6, 2021
@memorydream
Copy link
Collaborator

据此, 我测试的时候还发现了如歌曲id 1873048358 出现了只有作曲没有作词的
{"version":1,"lyric":"作曲 : 井上拓\n"}
, 我将尝试重写过滤判断并提交pr.

编辑:
我改了两处判断,

    getRandomLyric() {
      if (this.liked.songs.length === 0) return;
      getLyric(
        this.liked.songs[randomNum(0, this.liked.songs.length - 1)]
      ).then(data => {
        if (data.lrc !== undefined && data.lrc.includes('作词'))
          this.lyric = data.lrc.lyric;
      });
    },

我在此直接判断是否存在值 '作词',

    pickedLyric() {
      if (this.lyric === undefined) return '';
      let lyric = this.lyric.split('\n');
      lyric = lyric.filter(l => {
        if (!l.includes('作词')) {
          return true;
        }
        return false;
      });
...

在 pickedLyric() 里直接过滤掉不含'作词', 在我本机上测试这样是可行的, 请你校对一下逻辑是否可以.

这样不行,pickedLyric这个方法的逻辑是随机在歌词里摘出几句,并显示在卡片上,所以做词作曲全部要过滤

原判断逻辑看上去没有问题

@rainbowflesh
Copy link
Contributor Author

rainbowflesh commented Nov 6, 2021

据此, 我测试的时候还发现了如歌曲id 1873048358 出现了只有作曲没有作词的
{"version":1,"lyric":"作曲 : 井上拓\n"}
, 我将尝试重写过滤判断并提交pr.
编辑:
我改了两处判断,

    getRandomLyric() {
      if (this.liked.songs.length === 0) return;
      getLyric(
        this.liked.songs[randomNum(0, this.liked.songs.length - 1)]
      ).then(data => {
        if (data.lrc !== undefined && data.lrc.includes('作词'))
          this.lyric = data.lrc.lyric;
      });
    },

我在此直接判断是否存在值 '作词',

    pickedLyric() {
      if (this.lyric === undefined) return '';
      let lyric = this.lyric.split('\n');
      lyric = lyric.filter(l => {
        if (!l.includes('作词')) {
          return true;
        }
        return false;
      });
...

在 pickedLyric() 里直接过滤掉不含'作词', 在我本机上测试这样是可行的, 请你校对一下逻辑是否可以.

这样不行,pickedLyric这个方法的逻辑是随机在歌词里摘出几句,并显示在卡片上,所以做词作曲全部要过滤

原判断逻辑看上去没有问题

我明白了.
在 getRandomLyric().getLyric() 中, 必须有 '作曲' 值的时候 this.lyric = data.lrc.lyric 才不会引起死循环, 我需要直接在里面处理判断是否保存 data.lrc.lyric 到 data()

编辑:
修改后的 getLyric()

    getLyric(
        this.liked.songs[randomNum(0, this.liked.songs.length - 1)]
      ).then(data => {
        if (data.lrc !== undefined) {
          let ifl = data.lrc.lyric.split('\n').filter(l => {
            if (l.includes('作词')) {
              this.lyric = data.lrc.lyric;
              return true + ifl;
            }
            return false;
          });
        }
      });

这样可以避免保存死循环.

@mikaela-khara
Copy link

mikaela-khara commented Nov 8, 2021 via email

@xiaogaozi
Copy link
Contributor

已证实 @isNijikawa 的 https://github.com/isNijikawa/YesPlayMusic/commit/05a3082676073e273fca688e7ae9c75e1e70b214 这个修复可以解决问题,感谢!

@lethefrost
Copy link

mac m1 4.2版本 同样问题

mac x86也卡死orz

qier222 pushed a commit that referenced this issue Nov 9, 2021
* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑
@wyzGitHub
Copy link

使用这个链接里修复版本的windows 版本 还存在界面卡住 不是每次都能复现BUG https://github.com/qier222/YesPlayMusic/actions/runs/1437734074

@memorydream
Copy link
Collaborator

@isNijikawa [00:00.000] 作词 : 无\n[00:01.000] 作曲 : 阿铭\n[99:00.00]纯音乐,请欣赏\n 在此数据上卡死了数次,你有什么头绪吗?源代码的最新构建

@rainbowflesh
Copy link
Contributor Author

rainbowflesh commented Nov 21, 2021

@isNijikawa [00:00.000] 作词 : 无\n[00:01.000] 作曲 : 阿铭\n[99:00.00]纯音乐,请欣赏\n 在此数据上卡死了数次,你有什么头绪吗?源代码的最新构建

这是哪首歌? 我需要测试一下.
给 pickedLyric() 的 if 判断加上

else if (l.includes('纯音乐,请欣赏')) {
          return true;
        }

试试?

@memorydream
Copy link
Collaborator

memorydream commented Nov 21, 2021

@isNijikawa [00:00.000] 作词 : 无\n[00:01.000] 作曲 : 阿铭\n[99:00.00]纯音乐,请欣赏\n 在此数据上卡死了数次,你有什么头绪吗?源代码的最新构建

这是哪首歌? 我需要测试一下. 给 pickedLyric() 的 if 判断加上

else if (l.includes('纯音乐,请欣赏')) {
          return true;
        }

试试?

https://music.163.com/#/song?id=437752427 是这一首
这个修改我一会试试

编辑:
image

lyric = lyric.filter(l => {
        if (l.includes('作词') || l.includes('作曲')) {
          return false;
        } else if (l.includes('纯音乐,请欣赏')) {
          return true;
        }
        return true;
      });

还是那条数据

编辑2:
目前发现只有同时存在 作词 作曲纯音乐,请欣赏 时才会出现这个问题
"[99:00.00]纯音乐,请欣赏\n" 这样的数据上没有问题

这是发现的第二条卡死的数据
"[00:00.000] 作词 : 无\n[00:01.000] 作曲 : 闫东炜/陆超徽\n[99:00.00]纯音乐,请欣赏\n

以上结果应用了新的if判断

qier222 pushed a commit that referenced this issue Dec 6, 2021
* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑

* 更进一步的避免取词卡死问题

* 更新网易云 api 到 4.2.0

* Update README.md

* Revert "Update README.md"

This reverts commit b862ef7.
qier222 pushed a commit that referenced this issue Dec 20, 2021
* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑

* 更进一步的避免取词卡死问题

* 更新网易云 api 到 4.2.0

* Update README.md

* Revert "Update README.md"

This reverts commit b862ef7.

* Update lyrics.vue
@rainbowflesh
Copy link
Contributor Author

rainbowflesh commented Dec 20, 2021

太鬼畜了, 歌曲 id 1463539724 的

Lux 歌手:Ryan Taubert 所属专辑:Lux

得到的数据是

{"lyric":"[00:00.000] 作词 : Ryan Glenn Taubert\n[00:01.000] 作曲 : Ryan Glenn Taubert\n[99:00.00]纯音乐,请欣赏\n"}

导致现在的逻辑依然会死循环歌词, 需要在 pickedLyric() 里过滤 "纯音乐,请欣赏", 这引发了一个疑惑, 为什么getRandomLyric() 里的保存歌词方法中的歌词过滤不起作用?

qier222 pushed a commit that referenced this issue Dec 21, 2021
* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑

* 更进一步的避免取词卡死问题

* 更新网易云 api 到 4.2.0

* Update README.md

* Revert "Update README.md"

This reverts commit b862ef7.

* Update lyrics.vue

* 过滤歌词
@Lucas-TY
Copy link

Lucas-TY commented Dec 24, 2021

undefined:1 GET http://localhost:27232/undefined?param=512y512 404 (Not Found)

还是卡住,reset不起作用,master branch编译的,win11 @isNijikawa

@memorydream
Copy link
Collaborator

memorydream commented Dec 24, 2021

我们可以考虑换个实现的思路吗?
目前这部分的实现是由v-for="(line, index) in pickedLyric"直接调用pickedLyric函数的,如果准备一个pickedLyric数组,获取数据和过滤的部分全部异步,超时就取消,对这种情况或许有效?

@pan93412
Copy link
Collaborator

我们可以考虑换个实现的思路吗?
目前这部分的实现是由v-for="(line, index) in pickedLyric"直接调用的,如果准备一个pickedLyric数组,获取数据和过滤的部分全部异步,超时就取消,对这种情况或许有效?

是可以 Promise.any。我晚點看看相關程式碼。

@rainbowflesh
Copy link
Contributor Author

rainbowflesh commented Dec 27, 2021

我们可以考虑换个实现的思路吗?
目前这部分的实现是由v-for="(line, index) in pickedLyric"直接调用的,如果准备一个pickedLyric数组,获取数据和过滤的部分全部异步,超时就取消,对这种情况或许有效?

是可以 Promise.any。我晚點看看相關程式碼。

promise 这个东西很有意思, 但是 vue 2 里 在 Promise.all 里似乎无法修改 $data 的内容.

我换了一个实现思路, 利用 @memorydream 提到的数组方法: 把 "纯音乐,请欣赏" 存入数组, 数组长度大于 1 就不保存歌词 (其实反过来如果没有歌词, 数组长度为 0 则不储存也可以).
现在 pickedLyric() 方法里也不需要过滤了.

pickedLyric() {
      if (this.lyric === undefined) return '';
      let lyric = this.lyric.split('\n');
      let lineIndex = randomNum(0, lyric.length - 1);
      while (lineIndex + 4 > lyric.length) {
        lineIndex = randomNum(0, lyric.length - 1);
      }
      return [
        lyric[lineIndex].split(']')[1],
        lyric[lineIndex + 1].split(']')[1],
        lyric[lineIndex + 2].split(']')[1],
      ];
    },
getRandomLyric() {
      if (this.liked.songs.length === 0) return;
      getLyric(
        this.liked.songs[randomNum(0, this.liked.songs.length - 1)]
      ).then(data => {
        if (data.lrc !== undefined) {
          var promise = data.lrc.lyric.split('\n').filter(l => {
            if (l.includes('纯音乐,请欣赏')) {
              return true;
            }
            return false;
          });
          if (promise.length === 0) {
            this.lyric = data.lrc.lyric;
          }
        }
      });
    }

然后我把测试用的歌做到了歌单里, 里面第一首歌以外全是引起卡死的歌, 方便大家做测试.
https://music.163.com/#/my/m/music/playlist?id=7198706557

@youlan2333
Copy link

youlan2333 commented Dec 28, 2021

同上,win11安装版,内存版稳定触,进软件3秒卡死,任务管理器显示cpu占用17%左右,在任务栏退出但还是有后台。重新打开应用又重开一个进程

QQ截图20211228102912

@memorydream
Copy link
Collaborator

同上,win11安装版,内存版稳定触,进软件3秒卡死,任务管理器显示cpu占用17%左右,在任务栏退出但还是有后台。重新打开应用又重开一个进程

QQ截图20211228102912

相关的pr正在等待合并

@pan93412
Copy link
Collaborator

pan93412 commented Dec 28, 2021

同上,win11安装版,内存版稳定触,进软件3秒卡死,任务管理器显示cpu占用17%左右,在任务栏退出但还是有后台。重新打开应用又重开一个进程

QQ截图20211228102912

相关的pr正在等待合并

越多人 Approve 我越敢合併(
而且 @qier222 似乎也應該發布新版了

pan93412 added a commit that referenced this issue Dec 28, 2021
* refactor(views/library): 修改取词逻辑

* refactor(views/library): clean up long-winded code

Co-authored-by: 是虹川飴 <r0akg9yxh@relay.firefox.com>
Closed: #1133
Fixed: #1019 #1127 #1067 #1064 #1058 #1022
@memorydream
Copy link
Collaborator

@pan93412
image
卡死,看来最新的修改依然有一些问题

@pan93412
Copy link
Collaborator

我真的很想知道為什麼會因為找不到歌詞而卡死⋯⋯ 😂

現在有點忙,我有空再處理。

@pan93412 pan93412 reopened this Dec 28, 2021
@memorydream
Copy link
Collaborator

我真的很想知道為什麼會因為找不到歌詞而卡死⋯⋯ 😂

現在有點忙,我有空再處理。

https://music.163.com/#/song?id=443291232 这是卡死的歌,我会尝试一下其他的方案

@memorydream
Copy link
Collaborator

问题查明了,不需要异步,也不需要什么乱七八糟的判断
image
忽略这一堆log,此处会在这个while里死循环
根据循环的逻辑,再反过来看看卡死的数据,共性是数据长度小于4
这样永远不会满足跳出循环的条件
建议直接重写相关逻辑,此处循环的取值影响到pickedLyric的返回值,需要一起修改

此代码在pickedLyric

@pan93412
Copy link
Collaborator

问题查明了,不需要异步,也不需要什么乱七八糟的判断 image 忽略这一堆log,此处会在这个while里死循环 根据循环的逻辑,再反过来看看卡死的数据,共性是数据长度小于4 这样永远不会满足跳出循环的条件 建议直接重写相关逻辑,此处循环的取值影响到pickedLyric的返回值,需要一起修改

此代码在[pickedLyric]

這段 code 居然已經存活這麼久了 😂
但我其實不清楚他原本想幹嘛

截圖 2021-12-28 下午9 56 07

@memorydream
Copy link
Collaborator

问题查明了,不需要异步,也不需要什么乱七八糟的判断 image 忽略这一堆log,此处会在这个while里死循环 根据循环的逻辑,再反过来看看卡死的数据,共性是数据长度小于4 这样永远不会满足跳出循环的条件 建议直接重写相关逻辑,此处循环的取值影响到pickedLyric的返回值,需要一起修改
此代码在[pickedLyric]

這段 code 居然已經存活這麼久了 😂 但我其實不清楚他原本想幹嘛

截圖 2021-12-28 下午9 56 07

我这边代码被我弄乱了,你们改吧

qier222 pushed a commit that referenced this issue Jan 3, 2022
* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑
qier222 pushed a commit that referenced this issue Jan 3, 2022
* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑

* 更进一步的避免取词卡死问题

* 更新网易云 api 到 4.2.0

* Update README.md

* Revert "Update README.md"

This reverts commit b862ef7.
qier222 pushed a commit that referenced this issue Jan 3, 2022
* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑

* 更进一步的避免取词卡死问题

* 更新网易云 api 到 4.2.0

* Update README.md

* Revert "Update README.md"

This reverts commit b862ef7.

* Update lyrics.vue
qier222 pushed a commit that referenced this issue Jan 3, 2022
* issues #1019 的迫真修复

* 修复 issues #1019

* 修复 issues #1019

* 改回 pickedLyric() 逻辑

* 更进一步的避免取词卡死问题

* 更新网易云 api 到 4.2.0

* Update README.md

* Revert "Update README.md"

This reverts commit b862ef7.

* Update lyrics.vue

* 过滤歌词
qier222 pushed a commit that referenced this issue Jan 3, 2022
* refactor(views/library): 修改取词逻辑

* refactor(views/library): clean up long-winded code

Co-authored-by: 是虹川飴 <r0akg9yxh@relay.firefox.com>
Closed: #1133
Fixed: #1019 #1127 #1067 #1064 #1058 #1022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment