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 custom formatting for RPC details and on-hover image text #154

Open
1 task done
hozarho opened this issue Sep 29, 2024 · 3 comments · May be fixed by #155
Open
1 task done

Add custom formatting for RPC details and on-hover image text #154

hozarho opened this issue Sep 29, 2024 · 3 comments · May be fixed by #155
Labels
enhancement New feature or request

Comments

@hozarho
Copy link

hozarho commented Sep 29, 2024

Is there an existing issue for this?

  • I have searched the existing feature requests

Is your feature request related to a problem? Please describe

Currently the setting for music/movies display looks like this (excerpt from my config):

    "music": {
      "display": [
        "album","year","genres"
      ],
      "separator": "-"
    },

For my use-case, I find this pretty limiting, as all values are separated by same separator, in one line. Current result:
image

In effect, we have a long line with the set values, and one line for Jellyfin-RPC v{VERSION}

Hovering the album cover also shows the version:
image

I'd love to have the possiblity to customize on-hover text and both lines separately, using some kind of formatted string values. For example, I'd like to see album title popup on image hover (instead of Jellyfin-RPC version), and instead of line1=By <album name> - <rest of values separated by same separator>, line2=<jellyfin-rpc version> I'd like to use separate values with some custom formatting.

Describe the solution you'd like

I think the solution here would be adding more options for music/movies display.

For my case, I'd like to be able to set up something like this:

    "music": {
      "display": {
        "image_text": "{album} ({year})",
        "details_line_1": "by {artist}",
        "details_line_2": "on {album} ({year}) - {genres}"
      }
    },

Result:
image

On image hover:
image

Describe alternatives you've considered

No response

Additional context

No response

@hozarho hozarho added the enhancement New feature or request label Sep 29, 2024
@jamen
Copy link

jamen commented Oct 3, 2024

I've been thinking about this exact thing lately. Apparently there's no way to use Rust's std::fmt for this, because that only works at compile-time, but a simple series of str::replaces would suffice.

@jamen
Copy link

jamen commented Oct 3, 2024

I messed around with this and hit an issue: The image text and the third line are the same and can't be set separately. The first and second lines can, though.

It wasn't clear to me if newlines are possible in the first two lines. I tried putting \n and \r\n, but they turn into spaces for me. This was the only information I found (for the C# Rich Presence library), but its over 3 years old and seems outdated.

So, the only compromises I can think would be {track_title} by {artists} on the first line, on {albums} - {genres} on the second line, for example. Or just hijacking the image text, and making the text that pops up on hover a bit out of place. The choice can be left up to the user with the formatting options, though.

@jamen jamen linked a pull request Oct 3, 2024 that will close this issue
@Radiicall Radiicall linked a pull request Oct 6, 2024 that will close this issue
@hozarho
Copy link
Author

hozarho commented Oct 7, 2024

Thanks for taking this issue.

The image text and the third line are the same and can't be set separately. The first and second lines can, though.

This Discord limitation is a bit disappointing, hopefully one day they will offer an option in their API to separate it.

Also a suggestion: just so previous configurations could still work, music.display could be a union (or Rust "enum") of either array or JSON object. Depending on the used data type of display, the format would be different:

  • array value - legacy type, would work like it did so far (list of display options, separated by separator)
    "music": {
      "display": [
        "album",
        "year",
        "genres"
      ],
      "separator": "-" // in use, as display value is an array
    },
  • JSON object - would be this new version with formattting
    "music": {
      "display": {
        "details_text": "{track}",       // first line
        "state_text": "by {artists}",    // second line
        "image_text": "{album} ({year})" // third line / text on image hover
      },
      "separator": "-" // not used since display value is not an array, we use our custom formatting
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants