jcorporation / myMPD

myMPD is a standalone and mobile friendly web mpd client with a tiny footprint and advanced features.
https://jcorporation.github.io/myMPD/
GNU General Public License v3.0
419 stars 65 forks source link

Some synced lyrics enhancements #449

Closed jcorporation closed 3 years ago

jcorporation commented 3 years ago

I've just tested 6.12.0, nice to have the synced lyrics working :) A few little things I want to mention:

Also, is it possible to have a soft scroll effect for the text?

Originally posted by @Hajuskin in https://github.com/jcorporation/myMPD/discussions/448

jcorporation commented 3 years ago

The big line spacing is in my opinion not ideal for following the scrolling text, a normal spacing might be better

Empty lines in the lyrics are not displayed

Both is fixed in devel

If you scroll the text manually, it will jump back when the next line is played.

A button to disable scrolling is added.

Also, is it possible to have a soft scroll effect for the text?

I added smooth scrolling option to the scrollIntoView call, but I saw no big difference.

Hajuskin commented 3 years ago

Both is fixed in devel

Looking good, but I noticed that after some empty lines (I think only empty lines that are displayed very short) the next line with text is skipped.

A button to disable scrolling is added.

Working and I think it's a useful solution. Maybe you could add a feature that will disable auto scrolling when the text is manualy scrolled?

I added smooth scrolling option to the scrollIntoView call, but I saw no big difference.

Thank you for this, I think there's definitely a noticeable difference. It's a subtle difference when it's only scrolling to the next line, but if you scroll manually and it jumps back to the recent line it will actually scroll and not just jump straight to the line. Lowering the scroll speed might make this effect more visible, but I'm not sure if it's worth it.

Then I've found some files where the sylt-Tag is not read correctly

0: encoding: 1
0: lang: eng
0: timestamp: 2
0: contenttype: 1
0: desc: Lyrics were Saved by MiniLyrics.
0: lyrics:
[.][.]I[0]'[0]m[0] [0]a[0]-[0]g[0]o[0]n[0]n[0]a[0] [0]t[0]e[0]l[0]l[0] [0]y[0]o[0]u[0] [0]h[0]o[0]w[0] [0]i[0]t[0]'[0]s[0] [0]g[0]o[0]n[0]n[0]a[0] [0]b[0]e[0][0][0][0][0]&[.][.][.]Y[0]o[0]u[0][.] r[0]e[0] [0]g[0]o[0]n[0]n[0]a[0] [0]g[0]i[0]v[0]e[0] [0]y[0]o[0]u[0]r[0] [0]l[0]o[0]v[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0]h[0]o[0]w[0] [0]I[0] [0]f[0]e[0]e[0]l[0][0][0][0][0][.][.][.][.]A[0] [0]l[0]o[0]v[0]e[0] [0]f[0]o[0]r[0] [0]r[0]e[0]a[0]l[0] [0]n[0]o[0]t[0] [0]f[0]a[0]d[0]e[0] [0]a[0]w[0]a[0]y[0][0][0][0][0][.]8[.][.] [0][0][0][0][.][.][.][.][.]I[0]'[0]m[0] [0]a[0]-[0]g[0]o[0]n[0]n[0]a[0] [0]t[0]e[0]l[0]l[0] [0]y[0]o[0]u[0] [0]h[0]o[0]w[0] [0]i[0]t[0]'[0]s[0] [0]g[0]o[0]n[0]n[0]a[0] [0]b[0]e[0][0][0][0][.][.][.][.][.]Y[0]o[0]u[0][.] r[0]e[0] [0]g[0]o[0]n[0]n[0]a[0] [0]g[0]i[0]v[0]e[0] [0]y[0]o[0]u[0]r[0] [0]l[0]o[0]v[0]e[0] [0]t[0]o[0] [0]m[0]e[0][0][0][0][.][.][.][.][.]A[0] [0]l[0]o[0]v[0]e[0] [0]t[0]o[0] [0]l[0]a[0]s[0]t[0] [0]a[0]-[0]m[0]o[0]r[0]e[0] [0]t[0]h[0]a[0]n[0] [0]o[0]n[0]e[0] [0]d[0]a[0]y[0][0][0][0][.][.][.][.][.]A[0] [0]l[0]o[0]v[0]e[0] [0]t[0]h[0]a[0]t[0]'[0]s[0] [0]l[0]o[0]v[0]e[0] [0]-[0] [0]n[0]o[0]t[0] [0]f[0]a[0]d[0]e[0] [0]a[0]w[0]a[0]y[0][0][0][0][.][.][.][.][.]A[0] [0]l[0]o[0]v[0]e[0] [0]t[0]h[0]a[0]t[0]'[0]s[0] [0]l[0]o[0]v[0]e[0] [0]-[0] [0]n[0]o[0]t[0] [0]f[0]a[0]d[0]e[0] [0]a[0]w[0]a[0]y[0][0][0][0][.][.][.]

---

ÿþI': 30478:44.736
a-: 28801:21.664
nn: 27123:18.144
te: 30199:26.976
 y: 31038:20.928
 h: 31038:21.440
 i: 32436:07.40
s : 28801:21.664
nn: 27123:18.144
be: 00:00.00
&ÔÿþYo: 32715:40.704
re: 8948:17.280
on: 30758:38.592
 g: 29360:37.888
e : 33834:31.552
ur: 8948:18.560
ov: 28241:47.08
to: 8948:18.816
e: 00:00.58
ÞÿþI : 33275:13.536
nn: 27123:18.144
lo: 32995:37.344
 y: 31038:20.928
 n: 29360:34.48
ht: 8948:15.744
nd: 8948:16.512
ay: 00:00.00
N˜ÿþYo: 32715:42.464
kn: 31038:21.440
 m: 33834:11.328
lo: 32995:37.344
 a: 12583:22.880
ot: 8948:17.24
ad: 28241:47.08
aw: 27123:40.928
: 00:25.00
ÿþA-: 33275:14.560
ll: 12303:25.696
yo: 32715:42.464
kn: 31038:21.440
 m: 33834:11.328
lo: 32995:37.344
 a: 12583:22.880
ot: 8948:17.24
ad: 28241:47.08
aw: 27123:40.928
: 00:29.730
ÿþ : 00:00.133
ÿþMy: 8948:18.560
ov: 28241:47.08
a-: 27403:14.48
gg: 28242:08.00
 t: 29080:55.296
n : 27123:18.144
ca: 27962:28.480
ll: 27123:35.296
: 00:42.270
ÿþI : 32436:26.240
y : 32436:25.472
 s: 29080:58.880
w : 29360:37.376
 a: 30758:39.360
 y: 31038:20.928
 d: 31877:09.504
ve: 8948:15.744
-m: 28241:47.08
ba: 27682:51.776
: 00:47.270
ÿþYo: 32716:03.456
 l: 31038:21.184
e : 28521:44.448
r : 30479:02.400
 a: 12583:21.88
ot: 8948:20.608
o : 27403:13.24
 r: 28242:03.648
l: 00:00.204
$ÿþFo: 31876:50.816
yo: 32715:42.464
to: 8948:18.304
no: 33274:56.896
ju: 32156:49.536
 h: 31038:21.440
 I: 8948:17.24
ee: 30198:59.328
: -8918:-21.-442
A : 30199:27.744
ve: 8948:17.24
or: 8948:20.96
ea: 30199:07.520
no: 32436:05.248
fa: 27962:27.456
 a: 33275:13.536
y: 00:00.244
8ÿþ : 00:00.261
†ÿþI': 30478:44.736
a-: 28801:21.664
nn: 27123:18.144
te: 30199:26.976
 y: 31038:20.928
 h: 31038:21.440
 i: 32436:07.40
s : 28801:21.664
nn: 27123:18.144
be: 00:00.01
°ÿþYo: 32715:40.704
re: 8948:17.280
on: 30758:38.592
 g: 29360:37.888
e : 33834:31.552
ur: 8948:18.560
ov: 28241:47.08
to: 8948:18.816
e: 00:00.418
ÀÿþA : 30199:27.744
ve: 8948:20.608
o : 30199:24.160
st: 8948:15.744
-m: 31038:20.160
e : 32436:23.680
an: 8948:19.328
ne: 8948:16.512
ay: 00:00.01
·ÿþA : 30199:27.744
ve: 8948:20.608
ha: 32436:07.40
s : 30199:27.744
ve: 8948:02.432
 n: 31038:20.672
 f: 27123:35.552
e : 27123:40.416
ay: 00:00.01
ÊÞÿþA : 30199:27.744
ve: 8948:20.608
ha: 32436:07.40
s : 30199:27.744
ve: 8948:02.432
 n: 31038:20.672
 f: 27123:35.552
e : 27123:40.416
ay: 00:00.01
Ýø

These are the first lines of the actual text:

I'm a-gonna tell you how it's gonna be
You’re gonna give your love to me
I wanna love you night and day
You know my love a-not fade away
A-well, you know my love a-not fade away 

So it picks two chars and then skipps the next two and so on. I'll send you a test mp3 with these tags.

jcorporation commented 3 years ago

The encoding is the problem. The parser understands only Latin-1. I will enhance the parser.

Your file uses only Latin-1 characters. Have you a file with non Latin-1 text and unicode encoding?

Hajuskin commented 3 years ago

I have send you a file which should be encoded in unicode (cyrillic text)

jcorporation commented 3 years ago

Could it be, that the file is not 100% correct? kid3 shows only first synced lyrics line. I created a synced lyrics tag from the uslt tag and it now works with mpd devel. The gist is also updated. Would you give it a try?

Hajuskin commented 3 years ago

Don't know, i created a 30 second silent track with audacity and inserted the lyrics with minilyrics, MusicBee shows them correctly.

The gist works fine, although some unicode characters were not resolved (like \u2019)

0: encoding: 1
0: lang: eng
0: timestamp: 2
0: contenttype: 1
0: desc:
0: lyrics:
[.][.]I[0]'[0]m[0] [0]a[0]-[0]g[0]o[0]n[0]n[0]a[0] [0]t[0]e[0]l[0]l[0] [0]y[0]o[0]u[0] [0]h[0]o[0]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0]m[0]e[0] [0]a[0]-[0]g[0]o[0]t[0] [0]t[0]o[0] [0]b[0]e[0] [0]r[0]e[0]a[0]l[0][0][0][0][0][.]$[.][.]F[0]o[0]r[0] [0]y[0]o[0]u[0] [0]t[0]o[0] [0]k[0]n[0]o[0]w[0] [0]j[0]u[0]s[0]t[0] [0]h[0]o[0]w[0] [0]I[0] [0]f[0]e[0]e[0]l[0][0][0][0][0][.][.][.][.]A[0] [0]l[0]o[0]v[0]e[0] [0]f[0]o[0]r[0] [0]r[0]e[0]a[0]l[0] [0]n[0]o[0]t[0] [0]f[0]a[0]d[0]e[0] [0]a[0]w[0]a[0]y[0][0][0][0][0][.]8[.][.][0][0][0][.][.][.][.][.]I[0]'[0]m[0] [0]a[0]-[0]g[0]o[0]n[0]n[0]a[0] [0]t[0]e[0]l[0]l[0] [0]y[0]o[0]u[0] [0]h[0]o[0]w[0] [0]i[0]t[0]'[0]s[0] [0]g[0]o[0]n[0]n[0]a[0] [0]b[0]e[0][0][0][0][.][.][.][.][.]Y[0]o[0]u[0][.] r[0]e[0] [0]g[0]o[0]n[0]n[0]a[0] [0]g[0]i[0]v[0]e[0] [0]y[0]o[0]u[0]r[0] [0]l[0]o[0]v[0]e[0] [0]t[0]o[0] [0]m[0]e[0][0][0][0][.][.][.][.][.]A[0] [0]l[0]o[0]v[0]e[0] [0]t[0]o[0] [0]l[0]a[0]s[0]t[0] [0]a[0]-[0]m[0]o[0]r[0]e[0] [0]t[0]h[0]a[0]n[0] [0]o[0]n[0]e[0] [0]d[0]a[0]y[0][0][0][0][.][.][.][.][.]A[0] [0]l[0]o[0]v[0]e[0] [0]t[0]h[0]a[0]t[0]'[0]s[0] [0]l[0]o[0]v[0]e[0] [0]-[0] [0]n[0]o[0]t[0] [0]f[0]a[0]d[0]e[0] [0]a[0]w[0]a[0]y[0][0][0][0][.][.][.][.][.]A[0] [0]l[0]o[0]v[0]e[0] [0]t[0]h[0]a[0]t[0]'[0]s[0] [0]l[0]o[0]v[0]e[0] [0]-[0] [0]n[0]o[0]t[0] [0]f[0]a[0]d[0]e[0] [0]a[0]w[0]a[0]y[0][0][0][0][.][.][.]

---

I'm a-gonna tell you how it's gonna be: 00:09.940
You\u2019re gonna give your love to me: 00:15.70
I wanna love you night and day: 00:20.120
You know my love a-not fade away: 00:25.00
A-well, you know my love a-not fade away: 00:29.730
: 00:34.70
My love a-bigger than a cadillac: 00:42.270
I try to show it and you drive a-me back: 00:47.270
Your love for me a-got to be real: 00:52.260
For you to know just how I feel: 00:57.370
A love for real not fade away: 01:02.520
: 01:06.950
I'm a-gonna tell you how it's gonna be: 01:42.320
You\u2019re gonna give your love to me: 01:47.200
A love to last a-more than one day: 01:52.410
A love that's love - not fade away: 01:57.470
A love that's love - not fade away: 02:02.360

This lyrics obviously uses different quote-characters :D

Buddy.zip

jcorporation commented 3 years ago

The \u escapes are intended, JSON will handle this correctly.

Hajuskin commented 3 years ago

Just downloaded the latest devel container and it works fine :)

jcorporation commented 3 years ago

I reworked the SYLT parser completely to support latin, utf16le, utf16be and utf8. Would you test again? My testfiles are all parsed correctly.

The support for UTF16 surrogate pairs is not tested. It seems kid3 does not support this and I had no other tagger that supports writing sylt tags.

All files you has sent are utf16le or latin encoded.

It seems SYLT tags are not widely supported...

Hajuskin commented 3 years ago

If the changes were already included in the latest docker image then it seems to work. I tested with a few files, including the ones that previously had problems, all were displayed correctly. But with some files I get a "Can not parse response to json object" error, I think it's when the lyric includes double quotation mark (").

And another small thing: Most of my files have synced and unsynced lyrics, and myMPD lists them both. The unsynced Lyrics were listed with the language tag (eg. "eng"), the synced lyrics sometimes as "Lyrics were Saved by MiniLyrics. (eng)", sometimes with additional tags like "[lenght:XX]" and [al:Artist]" and rarely just with the language tag. myMPD Don't know if that's because minilyrics writes wired stuff in the language tag or if it's something else.

jcorporation commented 3 years ago

But with some files I get a "Can not parse response to json object" error, I think it's when the lyric includes double quotation mark (").

I forgot to encode the ascii chars properly.

Don't know if that's because minilyrics writes wired stuff in the language tag or if it's something

SYLT and USLT tags have a language and a description field. myMPD reads both and combines it.

Hajuskin commented 3 years ago

SYLT and USLT tags have a language and a description field. myMPD reads both and combines it.

Ah ok, I think that minilyrics occasionally writes the song info into the description field, but writing the lyrics to the file a second time seems to fix this. Now I have to find a way to edit the description field to get rid of the minilyrics branding :D

jcorporation commented 3 years ago

I forgot to encode the ascii chars properly.

This is fixed with commit eabb4ee60f7b1834291e3c9387223a59998e07c7