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

Add Lyric support #4733

Merged
merged 2 commits into from
Apr 21, 2024
Merged

Conversation

robert-hamilton36
Copy link
Contributor

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

@sonarcloud

This comment was marked as outdated.

@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Sep 8, 2023
@jellyfin-bot

This comment was marked as outdated.

@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Oct 3, 2023
@sonarcloud

This comment was marked as outdated.

@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Nov 9, 2023
@jellyfin-bot

This comment was marked as outdated.

@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Dec 18, 2023

This comment was marked as outdated.

@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Jan 12, 2024
@jellyfin-bot

This comment was marked as outdated.

@ebkalderon
Copy link

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?

@robert-hamilton36
Copy link
Contributor Author

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

@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Feb 2, 2024
@robert-hamilton36 robert-hamilton36 marked this pull request as ready for review February 2, 2024 06:28
@robert-hamilton36 robert-hamilton36 requested a review from a team as a code owner February 2, 2024 06:28
@thornbill
Copy link
Member

I believe this will require changes to be compatible with jellyfin/jellyfin#9951

@thornbill thornbill added this to the v10.9.0 milestone Mar 5, 2024
@thornbill thornbill added feature New feature or request release-highlight A major new feature for the next release labels Mar 5, 2024
@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Mar 24, 2024
@jellyfin-bot
Copy link
Collaborator

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

Copy link
Contributor

@dmitrylyzo dmitrylyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed without testing.

src/components/itemContextMenu.js Outdated Show resolved Hide resolved
src/components/itemContextMenu.js Outdated Show resolved Hide resolved
src/components/itemContextMenu.js Outdated Show resolved Hide resolved
src/components/nowPlayingBar/nowPlayingBar.js Outdated Show resolved Hide resolved
src/components/nowPlayingBar/nowPlayingBar.js Outdated Show resolved Hide resolved
src/controllers/itemDetails/index.js Outdated Show resolved Hide resolved
src/controllers/lyrics.js Outdated Show resolved Hide resolved
src/controllers/playback/queue/index.html Outdated Show resolved Hide resolved
src/controllers/playback/queue/index.html Outdated Show resolved Hide resolved
src/scripts/deleteHelper.js Outdated Show resolved Hide resolved
@thornbill
Copy link
Member

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.

Copy link
Contributor

@dmitrylyzo dmitrylyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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?

src/components/itemContextMenu.js Outdated Show resolved Hide resolved
src/components/itemContextMenu.js Outdated Show resolved Hide resolved
src/components/remotecontrol/remotecontrol.js Outdated Show resolved Hide resolved
src/controllers/itemDetails/index.js Outdated Show resolved Hide resolved
src/controllers/lyrics.html Outdated Show resolved Hide resolved
@robert-hamilton36
Copy link
Contributor Author

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

@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Mar 27, 2024
@robert-hamilton36
Copy link
Contributor Author

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 73c01fb
  2. possible fix suggested above
  3. fixed with cd8d5c7 and then 83bee29
  4. fixed with 286e0bf

@robert-hamilton36
Copy link
Contributor Author

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 f1d955a

Or else I might need a bit of guidance

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint doesn't pass. Please fix all ESLint issues.

src/components/nowPlayingBar/nowPlayingBar.js Outdated Show resolved Hide resolved
src/controllers/lyrics.js Outdated Show resolved Hide resolved
src/controllers/lyrics.js Outdated Show resolved Hide resolved
@dmitrylyzo
Copy link
Contributor

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.

@robert-hamilton36
Copy link
Contributor Author

robert-hamilton36 commented Mar 28, 2024

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

@dmitrylyzo
Copy link
Contributor

dmitrylyzo commented Mar 28, 2024

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. 🤷‍♂️

@robert-hamilton36
Copy link
Contributor Author

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

src/components/itemContextMenu.js Outdated Show resolved Hide resolved
src/components/nowPlayingBar/nowPlayingBar.js Outdated Show resolved Hide resolved
src/components/nowPlayingBar/nowPlayingBar.js Outdated Show resolved Hide resolved
src/components/remotecontrol/remotecontrol.js Outdated Show resolved Hide resolved
Copy link
Contributor

@dmitrylyzo dmitrylyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I forgot to submit review.

src/styles/lyrics.scss Outdated Show resolved Hide resolved
src/controllers/lyrics.js Show resolved Hide resolved
Copy link
Contributor

@dmitrylyzo dmitrylyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are the last ones. 🤞

This PR requires squashing before merging.

src/controllers/lyrics.js Outdated Show resolved Hide resolved
src/controllers/lyrics.js Outdated Show resolved Hide resolved
Copy link
Contributor

@dmitrylyzo dmitrylyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Who will squash the commits?

@robert-hamilton36
Copy link
Contributor Author

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

@dmitrylyzo
Copy link
Contributor

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.

@robert-hamilton36
Copy link
Contributor Author

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

Copy link

sonarcloud bot commented Apr 11, 2024

Quality Gate Passed Quality Gate passed

Issues
4 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
2.6% Duplication on New Code

See analysis details on SonarCloud

@jellyfin-bot
Copy link
Collaborator

Cloudflare Pages deployment

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

View build logs
View bot logs

@ebkalderon

This comment has been minimized.

@thornbill thornbill merged commit 3f967f7 into jellyfin:master Apr 21, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request release-highlight A major new feature for the next release
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants