jellyfin-web icon indicating copy to clipboard operation
jellyfin-web copied to clipboard

Add Lyric support

Open robert-hamilton36 opened this issue 11 months ago • 11 comments

Changes Adds route for lyrics. Will show current lyric highlighted if saved file allows it Add item detail page for individual songs that show the lyrics

Previews

#/Lyrics image

#/details?id={songsitemId} image

robert-hamilton36 avatar Jul 28 '23 02:07 robert-hamilton36

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
2.7% 2.7% Duplication

sonarcloud[bot] avatar Jul 28 '23 02:07 sonarcloud[bot]

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

jellyfin-bot avatar Sep 08 '23 19:09 jellyfin-bot

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

No Coverage information No Coverage information
2.7% 2.7% Duplication

sonarcloud[bot] avatar Oct 03 '23 04:10 sonarcloud[bot]

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

jellyfin-bot avatar Nov 09 '23 20:11 jellyfin-bot

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

7 New issues
0 Security Hotspots
No data about Coverage
1.3% Duplication on New Code

See analysis details on SonarCloud

sonarcloud[bot] avatar Dec 18 '23 01:12 sonarcloud[bot]

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

jellyfin-bot avatar Jan 12 '24 21:01 jellyfin-bot

Hey there! Just wondering what other work might need to be done before this PR can be taken out of draft and reviewed. The implementation itself looks great. Might this be blocked on something that needs additional help shepherding through?

ebkalderon avatar Jan 24 '24 17:01 ebkalderon

Oh no, Sorry. I didn't mean to leave it in draft. I think its good to go and be reviewed.

robert-hamilton36 avatar Feb 02 '24 03:02 robert-hamilton36

I believe this will require changes to be compatible with https://github.com/jellyfin/jellyfin/pull/9951

thornbill avatar Feb 21 '24 20:02 thornbill

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

jellyfin-bot avatar Mar 24 '24 08:03 jellyfin-bot

You also need to rebase or merge master back into this branch to fix the conflicts. We are still interested in getting this in for 10.9.0 if we can get it reviewed and any issues resolved this week.

thornbill avatar Mar 26 '24 07:03 thornbill

Another pass.

1. Shouldn't we close the lyrics page after music stops?

2. This is not good in TV display mode as there is no scrolling. In fact, we don't handle text blocks in TV display mode well.

3. In Mobile display mode, the `Lyrics` button is small. This may be improved in the future. Maybe after a redesign or so.
   ![lyrics-small-button](https://private-user-images.githubusercontent.com/56478732/316880558-840ac490-0514-4e65-bf3a-5b482cca6da4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE0ODIyOTUsIm5iZiI6MTcxMTQ4MTk5NSwicGF0aCI6Ii81NjQ3ODczMi8zMTY4ODA1NTgtODQwYWM0OTAtMDUxNC00ZTY1LWJmM2EtNWI0ODJjY2E2ZGE0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzI2VDE5Mzk1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIwMTI2ZTYwM2YzNTI3N2Y2N2RmN2RiZjg1YWY0YzllYThjYzljYWFkZjU0NWNhZDA0YTNmOWE3MjA2OGJjN2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.1bXojUGQ-M3MNf5AotbfuqQf4JkUBu0zsjLNZ1uyqpc)

UPD: 4. There is a new section called More From This Album. It doesn't seem to be related to the lyrics feature. Maybe it should be moved to the new PR?

  1. Yes that would be a good idea. I'm thinking i'll just have to add an event for 'playbackstop' that appRouter.back()
  2. Right silly me I guess I must have always used my scroll wheel, not realizing tvs couldn't do that. Assuming the keyboards arrow keys act the same as the tvs remotes navigation, I'll look into add scrolling. I'm not familiar with how its been implemented already in menus
  3. Hmm yes, secondary buttons are hidden in mobile mode. I didn't realize and left the lyric button visible. I'll hide it, the problem is getting back onto that lyric page. For now, what I can do is add that lyric button to the item details page like so

Add Mic

Which would require accessing view lyrics from the context menu and than clicking the mic button

  1. Yes its not directly related to the lyric feature. My thinking was, that the new section is only relevant because of the new route #/details?id={songsitemId} that is opened on the view lyrics context menu. But will move into a seperate PR

robert-hamilton36 avatar Mar 26 '24 21:03 robert-hamilton36

Another pass.

1. Shouldn't we close the lyrics page after music stops?

2. This is not good in TV display mode as there is no scrolling. In fact, we don't handle text blocks in TV display mode well.

3. In Mobile display mode, the `Lyrics` button is small. This may be improved in the future. Maybe after a redesign or so.
   ![lyrics-small-button](https://private-user-images.githubusercontent.com/56478732/316880558-840ac490-0514-4e65-bf3a-5b482cca6da4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE1MTcxNTksIm5iZiI6MTcxMTUxNjg1OSwicGF0aCI6Ii81NjQ3ODczMi8zMTY4ODA1NTgtODQwYWM0OTAtMDUxNC00ZTY1LWJmM2EtNWI0ODJjY2E2ZGE0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzI3VDA1MjA1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEyYzQwNTM1ZTVjNzlmOTY4OGM4ZDUxOWQwNzkzMDYxZTQ2NzNlYjJhZTYxMmI1MGJkNTY3MjNlZWQ3NjgyNjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.mTo9kmkdQzTnUj9nyn5q1TgYbniqka92DiX0cXpT-YE)

UPD: 4. There is a new section called More From This Album. It doesn't seem to be related to the lyrics feature. Maybe it should be moved to the new PR?

  1. fixed with https://github.com/jellyfin/jellyfin-web/pull/4733/commits/73c01fb688481c429f6d42092ec3ce3f2b6ff7f3
  2. possible fix suggested above
  3. fixed with https://github.com/jellyfin/jellyfin-web/pull/4733/commits/cd8d5c73de2d10c9b350dadcbc67f4cfe75983f7 and then https://github.com/jellyfin/jellyfin-web/pull/4733/commits/83bee29bd7c375a8804b71b34091180ff49453b6
  4. fixed with https://github.com/jellyfin/jellyfin-web/pull/4733/commits/286e0bf4f8e82897d7d87f3ad5b80304bd50b464

robert-hamilton36 avatar Mar 27 '24 05:03 robert-hamilton36

You also need to rebase or merge master back into this branch to fix the conflicts. We are still interested in getting this in for 10.9.0 if we can get it reviewed and any issues resolved this week.

I hope this was it https://github.com/jellyfin/jellyfin-web/pull/4733/commits/f1d955a941ce069b322cad69525a1b4f497d786f

Or else I might need a bit of guidance

robert-hamilton36 avatar Mar 27 '24 05:03 robert-hamilton36

I have found an issue. realeaseCurrentPlayer() doesn't seem to be unbinding events. So even after you exit the lyrics page the events are still being run in the background

EDIT: I've found the problem. bindToPlayer() was adding the callback to each event multiple times(whenever it was called) and unbind was only removing it once

FIXED: https://github.com/jellyfin/jellyfin-web/pull/4733/commits/61197cee3637ccbc5b5835d066350d8e251791ae

robert-hamilton36 avatar Mar 27 '24 23:03 robert-hamilton36

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

jellyfin-bot avatar Mar 28 '24 06:03 jellyfin-bot

The only thing that bothers me is this behavior:

1. Start music.

2. Click the now playing bar (open queue).

3. Open lyrics.

4. Stop music using the now playing bar.

5. The lyrics page executes `appRouter.back`.

6. The queue page appears to be broken.

Yes so I think appRouter.goHome() is the best option. Because if you stay on the lyric page, the arrow in the top left will still take you to the broken queue page

robert-hamilton36 avatar Mar 28 '24 09:03 robert-hamilton36

Yes so I think appRouter.goHome() is the best option. Because if you stay on the lyric page, the arrow in the top left will still take you to the broken queue page

This workaround seems to work:

diff --git a/src/controllers/playback/queue/index.js b/src/controllers/playback/queue/index.js
index d95081b91..60c541bea 100644
--- a/src/controllers/playback/queue/index.js
+++ b/src/controllers/playback/queue/index.js
@@ -1,4 +1,5 @@
 import RemoteControl from '../../../components/remotecontrol/remotecontrol';
+import { appRouter, history } from 'components/router/appRouter';
 import { playbackManager } from '../../../components/playback/playbackmanager';
 import libraryMenu from '../../../scripts/libraryMenu';
 import '../../../elements/emby-button/emby-button';
@@ -35,8 +36,19 @@ export default function (view) {
     }
 
     view.addEventListener('viewshow', function () {
+        const player = playbackManager.getCurrentPlayer();
+
+        if (!player) {
+            if (history.length > 1) {
+                appRouter.back();
+            } else {
+                appRouter.goHome();
+            }
+            return;
+        }
+
         libraryMenu.setTransparentMenu(true);
-        bindToPlayer(playbackManager.getCurrentPlayer());
+        bindToPlayer(player);
         document.addEventListener('keydown', onKeyDown);
 
         if (remoteControl) {

I hope it doesn't break anything.

dmitrylyzo avatar Mar 28 '24 10:03 dmitrylyzo

Yes so I think appRouter.goHome() is the best option. Because if you stay on the lyric page, the arrow in the top left will still take you to the broken queue page

This workaround seems to work:

diff --git a/src/controllers/playback/queue/index.js b/src/controllers/playback/queue/index.js
index d95081b91..60c541bea 100644
--- a/src/controllers/playback/queue/index.js
+++ b/src/controllers/playback/queue/index.js
@@ -1,4 +1,5 @@
 import RemoteControl from '../../../components/remotecontrol/remotecontrol';
+import { appRouter, history } from 'components/router/appRouter';
 import { playbackManager } from '../../../components/playback/playbackmanager';
 import libraryMenu from '../../../scripts/libraryMenu';
 import '../../../elements/emby-button/emby-button';
@@ -35,8 +36,19 @@ export default function (view) {
     }
 
     view.addEventListener('viewshow', function () {
+        const player = playbackManager.getCurrentPlayer();
+
+        if (!player) {
+            if (history.length > 1) {
+                appRouter.back();
+            } else {
+                appRouter.goHome();
+            }
+            return;
+        }
+
         libraryMenu.setTransparentMenu(true);
-        bindToPlayer(playbackManager.getCurrentPlayer());
+        bindToPlayer(player);
         document.addEventListener('keydown', onKeyDown);
 
         if (remoteControl) {

I hope it doesn't break anything.

If you manually enter /#/queue into the browser. The queue still has the playbar but with 3 added menus:

  1. Navigation
  2. Send message
  3. Enter text

They don't seem to do anything, but I don't know if its still in use or not. But this fix will stop you from getting to this menu.

Queue

Looking at all the uses of appRouter.showNowPlaying(), they all appear to only be available when playing music (apart from inputManager which doesn't appear to be in use at all). And so would never take you to that screen in this format

robert-hamilton36 avatar Mar 28 '24 20:03 robert-hamilton36

If you manually enter /#/queue into the browser. The queue still has the playbar but with 3 added menus:

When I tested, it redirected back if there was something open, or went to the home page when entered in a blank tab.

But this fix will stop you from getting to this menu.

I haven't tested remote control. This page should be accessible from the PlayOn button -> Remote control.

UPD: When connecting to another client (Cast to Device button), a session player is created that allows the queue page to be used. So it's normal that it doesn't work if you open it manually.

You can try it like this:

  1. Open Jellyfin in your normal browser. Let's call it Main.
  2. Open another Jellyfin in incognito window. You probably need to use a different Jellyfin user to log in.
  3. Click Cast to Device button (top right button before Search) on Main.
  4. Select another client (not My Device).
  5. Run music on Main client.
  6. Click Cast to Device on Main. Then Remote Control.

UPD2: Hmm, the imported history doesn't seem to have length. Using window.history helps, but not much - we can't redirect when entering .../#/queue in an empty tab (Chrome). So I dunno. :man_shrugging:

dmitrylyzo avatar Mar 28 '24 21:03 dmitrylyzo

I've reverted onPlaybackStop Behaviour to goHome(), until a work around is found

robert-hamilton36 avatar Mar 29 '24 22:03 robert-hamilton36

I can squash, assuming this is alright git reset --soft master git push-f master LyricsSupport

robert-hamilton36 avatar Apr 08 '24 21:04 robert-hamilton36

I can squash, assuming this is alright git reset --soft master git push-f master LyricsSupport

I don't think this will collect all the changes because merge commits (instead of rebase) were used.

There may be an easier way, but I am used to do it this way (being on the PR branch):

  1. Update the upstream. git fetch upstream, where upstream is a remote pointing to the upstream repo of jellyfin-web.
  2. Backup current branch. To compare with it later. git branch backup-rebase
  3. Run interactive rebase. git rebase -i upstream/master. In the rebase script, you must pick the first commit, others - fixup.
  4. Fix conflicts if any. Then, git rebase --continue. Until rebase is complete. You can abort rebase with git rebase --abort.
  5. Compare the current branch with the backup to see if there are any unnecessary changes.
  6. If it is fine, force push. If you ruin your branch, you can re-checkout it from the backup.

dmitrylyzo avatar Apr 09 '24 21:04 dmitrylyzo

I can squash, assuming this is alright git reset --soft master git push-f master LyricsSupport

I don't think this will collect all the changes because merge commits (instead of rebase) were used.

There may be an easier way, but I am used to do it this way (being on the PR branch):

1. Update the upstream.
   `git fetch upstream`, where `upstream` is a remote pointing to the upstream repo of jellyfin-web.

2. Backup current branch. To compare with it later.
   `git branch backup-rebase`

3. Run interactive rebase.
   `git rebase -i upstream/master`.
   In the rebase script, you must `pick` the first commit, others - `fixup`.

4. Fix conflicts if any. Then, `git rebase --continue`. Until rebase is complete.
   You can abort rebase with `git rebase --abort`.

5. Compare the current branch with the backup to see if there are any unnecessary changes.

6. If it is fine, force push.
   If you ruin your branch, you can re-checkout it from the backup.

Awesome! Thanks so much for all your help

robert-hamilton36 avatar Apr 09 '24 22:04 robert-hamilton36

Cloudflare Pages deployment

Latest commit 9a56230
Status ✅ Deployed!
Preview URL https://7e8d8d9d.jellyfin-web.pages.dev
Type 🔀 Preview

View build logs View bot logs

jellyfin-bot avatar Apr 11 '24 06:04 jellyfin-bot

Very excited to see this feature finally land in the 10.9 release, and not a moment too soon! Thanks to all involved. :tada:

ebkalderon avatar Apr 11 '24 14:04 ebkalderon