jitwxs / 163MusicLyrics

Windows 云音乐歌词获取【网易云、QQ音乐】
Apache License 2.0
1.98k stars 107 forks source link

Rounding Bugs with the Milliseconds Part in the Timestamp #109

Closed daoxi closed 2 years ago

daoxi commented 2 years ago

When using the 2-millisecond-digits LRC format [mm:ss.SS] (which is the standard format for LRC) and choosing to round the milliseconds number, it doesn't work as intended in certain scenarios:

For example, for this song: The original timestamp

[04:17.995]Everybody Get Low

will be rounded to

[04:17.10]Everybody Get Low

instead of the correct result

[04:18.00]Everybody Get Low

Another example in the same song: The original timestamp

[04:19.093]It's A Stickup Everybody Get Low

will be rounded to

[04:19.93]It's A Stickup Everybody Get Low

instead of the correct result

[04:19.09]It's A Stickup Everybody Get Low

To summarize, there are two issues with rounding in the timestamp:

  1. (as demonstrated in the 1st example) it can't round up the "ss" part when the "SS" part exceeds 99 (and it probably also can't round up the "mm" part when the "ss" part exceeds 59, for example, rounding a timestamp like [01:59.999] should result [02:00.00] rather than [01:60.00])
  2. (as demonstrated in the 2nd example) it omits/removes the zero(s) in miliseconds part from the original timestamp when it shouldn't. Please note that this issue happens no matter which option (either rounding or cropping the millisecond number) is selected.

Version tested: v4.6

--------------------------------Edit/Update--------------------------------

I just realized these two issues mentioned above only happens when you use NetEase Cloud Music as the lyrics source, I'm guessing it's because QQ Music already uses the standard format [mm:ss.SS], therefore the format conversion (including either rounding or cropping the numbers) is NOT performed when you choose [mm:ss.SS]? Note that a bug exists with lyrics from QQ Music too, see the post below for more detail.

daoxi commented 2 years ago

Found another bug which might also be related to how you dealt with the millisecond digits (i.e. it's probably related to the 2nd issue mentioned above):

The program seems to be adding extra zeros in the wrong place when choosing to use the [mm:ss.SSS] format.

Take this song as an example, when choosing to use the [mm:ss.SSS] format, the first few timestamps are:

[00:10.098]
[00:12.066]
[00:17.053]
[00:21.042]
[00:26.058]

(notice how the first digit in the SSS part is always 0 (this actually happens for the entire song too), so I'm assuming the original lyrics use the format [mm:ss.SS] rather than [mm:ss.SSS]), and when the program is trying to convert the format, it added zeros in the wrong place.

I suppose the correctly converted timestamps should be:

[00:10.980]
[00:12.660]
[00:17.530]
[00:21.420]
[00:26.580]

(notice how the zeros should be added in the end, not the beginning.)

*This bug seems to happen only when QQ Music is used as the source.