Ferry-200 / coriander_player

Windows端本地音乐播放器,使用Material You配色。Dart (Flutter) + Rust (lofty, windows-rs) + C (bass lib) 多语言项目。绝赞开发中。
https://ferry-200.github.io/coriander_player_website/
GNU General Public License v3.0
510 stars 22 forks source link

修复当本地歌词找不到中括号时崩溃的问题 #104

Closed Zhoucheng133 closed 2 weeks ago

Zhoucheng133 commented 2 weeks ago

还有一个部署遇到的问题:在pubspec.yaml中最好修改一下:

# - flutter_rust_bridge: ^2.0.0
# 去除^
- flutter_rust_bridge: 2.0.0

不然新获取的版本不符合会报错

Zhoucheng133 commented 2 weeks ago

打开会黑屏一下,因为用的window_manager依赖,可以根据这个链接的Hidden at launch方法去除开屏的黑块

Ferry-200 commented 2 weeks ago

谢谢 pr。看起来没什么问题,可以马上合并。

另外 issue 是误操作连接上了吗?我不认为这个 pr 与 #79 相关。

pubspec 那个文件都是 flutter pub add 的时候修改的,我完全没注意过这个问题。后面我再看看。

Zhoucheng133 commented 2 weeks ago

和关联的那个无关 打#没注意链接上了:(

Ferry-200 commented 2 weeks ago

感觉 contains 是不必要的,按照审查要求改一下就好🤔。

Zhoucheng133 commented 2 weeks ago

不对,使用原来的:

var lrcTimeString = line.substring(
  line.indexOf("[") + 1,
  line.indexOf("]"),
)

如果没有],那么后面那个是-1,substring不能用负数作为参数,而且必须大于等于line.indexOf("[") + 1

Ferry-200 commented 2 weeks ago

不对,使用原来的:

var lrcTimeString = line.substring(
  line.indexOf("[") + 1,
  line.indexOf("]"),
)

如果没有],那么后面那个是-1,substring不能用负数作为参数,而且必须大于等于line.indexOf("[") + 1

这样改就好

final left = line.indexOf("[");
final right = line.indexOf("]");
if (left == -1 || right == -1) return null;
var lrcTimeString = line.substring(
   left + 1,
   right
 );
Zhoucheng133 commented 2 weeks ago

这样也可以吧:D 另外把fromLrcText返回值改为Lrc?来返回null以通过其它方式获取歌词

Ferry-200 commented 2 weeks ago

这样也可以吧:D 另外把fromLrcText返回值改为Lrc?来返回null以通过其它方式获取歌词

这个可以。另外通过其他方式获取歌词是指什么

Zhoucheng133 commented 2 weeks ago

fromLrcText这个不加?怎么返回null哇 你在lyric_service中在调用Lrc.fromAudioPath(nowPlaying)的时候,若返回值为null,在本地歌词优先的情况下会从getMostMatchedLyric这个方法中获取歌词(应该是在线歌词?),如果getMostMatchedLyric(nowPlaying)Lrc.fromAudioPath(nowPlaying)都为null,那么lyricNullablevertical_lyric_view里为空(也就是都没有获取到歌词),根据下面的判定则显示无歌词界面

if(本地歌词优先){
  if(本地歌词结果为空){
    if(网络歌词结果为空){
      显示无歌词
    }else{
      显示网络歌词
    }
  }else{
     显示本地歌词
  }
}else{
  上面顺序反过来
}
Zhoucheng133 commented 2 weeks ago

fromAudioPath这个方法本来就是Lrc?,你把内层的Lrc.fromLrcText也改成Lrc?不影响结果,只是没有匹配到[]的时候会返回null罢了
顺便一提调用fromLrcText没怎么看懂为啥类的内部为啥要<类名>.<方法名>,直接<方法名>就可以了

Ferry-200 commented 2 weeks ago

是这种意思🧐没问题。另外多写类名应该是我顺手写了。先不改吧(