mierak / rmpc

A configurable, terminal based Media Player Client with album art support via various terminal image protocols
https://mierak.github.io/rmpc/
BSD 3-Clause "New" or "Revised" License
156 stars 8 forks source link

Implementation of lyrics tab #105

Closed acdcbyl closed 1 month ago

acdcbyl commented 1 month ago

Description

rmpc is so good that I can't get enough of it, maybe add a lyrics tab to it.Anyway, thanks to the developers for their work!

Proposed solution

No response

mierak commented 1 month ago

Hi, thanks for the kind words! Im glad you are enjoying rmpc.

I have thought about adding lyrics support in the past and it is something I would like to do. However it presents several questions which I do not have answers to at the moment. Namely:

acdcbyl commented 1 month ago

Hi, thanks for the kind words! Im glad you are enjoying rmpc.

I have thought about adding lyrics support in the past and it is something I would like to do. However it presents several questions which I do not have answers to at the moment. Namely:

  • What kind of lyrics do we want to support? Simple text lyrics or timed(lrc) lyrics as well?
  • Where do we put it in the UI? I think that separate tab is quite ugly, though we have configurable panes and making it into a pane solves this issue I think.
  • Where do we source the lyrics. When I checked I could not find a satisfactory source/service to use to search and download them on the fly. Having users bring their own is also an option, and the one I am leaning towards.

I am happy to get your reply! I have some small suggestions for what you are thinking about.

mierak commented 1 month ago

Ye, sounds good. Only real problem is what to do when the current song has no lyrics. Right now it would leave empty space under the album cover at all times as the layout system is rigid at the moment and cannot be changed at runtime. I will see what I can do when I get to it.

acdcbyl commented 1 month ago

Okay. Thank you very much for your work.

ionnux commented 1 month ago

For displaying lyrics, I suggest they temporarily replace the album cover when active, with an option to toggle lyrics on or off as needed.

For sourcing lyrics, there’s an open-source Android app called "SongSync" that integrates several backends for downloading lyrics. You might find it helpful as a reference.

I also wanted to take a moment to thank you for creating this app. I’ve been a long-time user of ncmpcpp, but since switching to your app, there’s been no turning back. It’s been a fantastic experience

mierak commented 1 month ago

For displaying lyrics, I suggest they temporarily replace the album cover when active, with an option to toggle lyrics on or off as needed.

Theres a bunch of limitations around how rigid the layout system in rmpc is at the moment. I have some ideas though.

For sourcing lyrics, there’s an open-source Android app called "SongSync" that integrates several backends for downloading lyrics. You might find it helpful as a reference.

I am still leaning towards making users bring their own lyrics. Those 3rd party services can become unavailable or simply not have the requested song in the database. Also I think that on_song_change could be used to automate this and we could provide a short example how to achieve that and this solution would be way more flexible than hardcoded lyrics providers.

Okay. Thank you very much for your work.

I also wanted to take a moment to thank you for creating this app. I’ve been a long-time user of ncmpcpp, but since switching to your app, there’s been no turning back. It’s been a fantastic experience

Thank you both for the kind words. They mean a lot!

NischalDawadi commented 1 month ago

sptlrx is great for viewing timed lyrics.

mierak commented 1 month ago

Hi, sorry it took so long. I have merged https://github.com/mierak/rmpc/pull/131. You can get synced lyrics by adding the Lyrics pane to your tab. The lyrics are resolved in two ways which are described here.

I am well aware that the implementation is not ideal at this point, but its been merged to get some feedback. I plan to add a way to get some kind of automatic download/search in the future as well as some way for the pane to hide itself when no lyrics are present. For now you can work around the second issue by creating multiple tabs.

I'm gonna close this issue for now, but don't hesitate to reopen it or create a new one!

NischalDawadi commented 2 weeks ago

I couldn't get lyrics pane to work. Any guide how to do it. Read docs but couldn't implement it.

acdcbyl commented 2 weeks ago

I couldn't get lyrics pane to work. Any guide how to do it. Read docs but couldn't implement it.

Now the new features have not been pushed to the official version, you can compile the new version yourself to test it

NischalDawadi commented 2 weeks ago

I am using the git version, what config parameter should i change.If i put lyrics in the same folder with correct naming does it show on its own or is there button to prompt it.

mierak commented 2 weeks ago

If you want the timed lyrics to be detected next to the song, you need to have lyrics_dir set to the same directory as your music_dir in mpd.conf. For example:

music_directory "~/Music"
lyrics_dir: "~/Music",

And then you need ~/Music/some/subdir/song.mp3 and ~/Music/some/subdir/song.lrc. Note that only time synced lyrics are supported.

Edit: You also need lyrics pane in your tabs config, something like:

 tabs: [
        (
            name: "Queue",
            border_type: None,
            pane: Split(
                direction: Horizontal,
                panes: [
                    (
                        size: "40%",
                        pane: Split(
                            direction: Vertical,
                            panes: [
                                (
                                    size: "14%",
                                    pane: Pane(Lyrics),
                                ),
                                (
                                    size: "86%",
                                    pane: Pane(AlbumArt),
                                )
                            ]
                        ),
                    ),
                    (
                        size: "60%",
                        pane: Pane(Queue),
                    ),
                ],
            ),
        ),
...
NischalDawadi commented 2 weeks ago

where to check for logs.. the config is giving error.

soifou commented 2 weeks ago

By default you will find it here:

NischalDawadi commented 2 weeks ago

I can't figure out what is wrong with my config

![enable(implicit_some)]

![enable(unwrap_newtypes)]

![enable(unwrap_variant_newtypes)]

( address: "127.0.0.1:6600", on_song_change: ["~/.config/rmpc/notify"], theme: Some("wallust"), // here! cache_dir: Some("/home/hypr/.cache/rmpc/"),

volume_step: 5, status_update_interval_ms: 1000, wrap_navigation: false, enable_mouse: true, album_art: ( method: Auto, max_size_px: (width: 600, height: 600), ), keybinds: ( global: { ":": CommandMode, "3": ArtistsTab, ",": VolumeDown, "s": Stop, ".": VolumeUp, "c": ToggleSingle, "1": QueueTab, "6": SearchTab, "": NextTab, "": NextTab, "5": PlaylistsTab, "": PreviousTab, "": PreviousTab, "q": Quit, "4": AlbumsTab, "x": ToggleRandom, ">": NextTrack, "<": PreviousTrack, "f": SeekForward, "v": ToggleConsume, "2": DirectoriesTab, "p": TogglePause, "z": ToggleRepeat, "b": SeekBack, "~": ShowHelp, "O": ShowOutputs, }, navigation: { "": UpHalf, "N": PreviousResult, "a": Add, "r": Rename, "n": NextResult, "g": Top, "": Select, "G": Bottom, "h": Left, "": Confirm, "i": FocusInput, "J": MoveDown, "j": Down, "": DownHalf, "/": EnterSearch, "": Close, "": Close, "K": MoveUp, "l": Right, "D": Delete, "k": Up, },

    queue: {
        "D":       DeleteAll,
        "<CR>":    Play,
        "<C-s>":   Save,
        "a":       AddToPlaylist,
        "d":       Delete,
        "i":       ShowInfo,
                },
                   ),
 tabs: [
    (
        name: "Queue",
        border_type: None,
        pane: Split(
            direction: Horizontal,
            panes: [
                (
                    size: "40%",
                    pane: Split(
                        direction: Vertical,
                        panes: [
                            (
                                size: "14%",
                                pane: Pane(Lyrics),
                            ),
                            (
                                size: "86%",
                                pane: Pane(AlbumArt),
                            )
                        ]
                    ),
                ),
                (
                    size: "60%",
                    pane: Pane(Queue),
                ),
            ],
        ),
    ),)
    2024-11-25T15:05:11.076742994Z WARN  src/main.rs:234 message="Failed to read config. Using default values. Check logs for more information" err="109:11: Expected opening `(` for struct `TabFile`" 
soifou commented 2 weeks ago

Hmm your config seems broken, it's missing the closing ] for tabs. Try to replace your very last line:

),) -> )],)

If you still have the same warning, I suggest you rewrite your conf from default, then carefully follow its suggestion (and the doc):

$ rmpc config > ~/.config/rmpc/config.ron
NischalDawadi commented 2 weeks ago

Thank you, no error now but still can't get the lyrics to work. mpd shows error if i put lyrics_dir: ~/Music in mpd.conf I have put lyrics into /Music/Artist_name/Album/song.lrc When i use rmpc lyricsindex it shows lyrics dir not configured.

soifou commented 2 weeks ago

Actually you have to put lyrics_dir: "~/Music" in your rmpc config.ron not in mdp.conf! The path must match music_directory "~/Music" in your mpd config :)

Your close to get it working, keep it up!

NischalDawadi commented 2 weeks ago

Yay, i got it working.Thank you so much. But the layout is so iffy. Now need to hunt for .lrc lyrics. image Any tool to automate lyrics in .lrc for large library.

mierak commented 2 weeks ago

Sorry I could have written the comment above a bit better and thanks @soifou for helping out. I plan to improve on error messages in config, but it is what it is for now.

Anyway, you could try leveraging something like https://github.com/raitonoberu/lyricsapi and https://mierak.github.io/rmpc/guides/on_song_change/ to sort of automate the downloading, but the lyrics will show up only on the next reload of the song this way because there is no way to notify rmpc to reload them at the moment.