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

Implement custom activity text for TV show episodes #177

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

hozarho
Copy link
Contributor

@hozarho hozarho commented Jan 30, 2025

Solves #174

Tested very briefly, but looks like it works as intended.

Example

// [...]
"shows": {
  "display": {
    "details_text": "S{season-padded}E{episode-padded} - {title} {sep} {original-title}",
    "state_text": "{genres} {sep} {studio}",
    "image_text": "{show-title} ({year})"
  },
  "separator": "•"
},
// [...]

Result

image

Changes

  • Add support for display custom activity text formatting for TV show episodes
  • API changes:
    • removed episode_display_options from Client struct in lib.rs - no longer used, replaced by shows_display_options
    • it's now possible to convert EpisodeDisplayOptions struct to DisplayFormat
  • Works with legacy configuration (show_simple, append_prefix and add_divider) if shows.display is not specified in the config.
  • Supported formatting items:
    • {show-title} - the TV show title
    • {title} - title of the episode
    • {original-title} - title of the episode in its original language
    • {episode} - number of the episode, not padded - for example 5
    • {episode-padded} - number of the episode, padded with zero - for example 05
    • {season} - number of the season, not padded - for example 2
    • {season-padded} - number of the season, padded with zero - for example 02
    • {year} - release year of current episode
    • {genres} - TV show genres
    • {studio} - studio of the TV show
    • {version} - Jellyfin-RPC version, used for default image_text
    • {sep} - separator
  • Added formatting item for movie display:
    • {original-title} - movie title in its original language

      // [...]
      "movies": {
        "display": {
          "details_text": "{title} ({year}) {sep} {original-title}",
      // [...]

      image

@hozarho hozarho mentioned this pull request Jan 30, 2025
1 task
@xNinjaKittyx
Copy link

Looks like CI is broken, but i'll try it out once it works again.

@xNinjaKittyx
Copy link

xNinjaKittyx commented Jan 31, 2025

I went ahead and just built it locally just to try it out.

Is it possible to also add SeriesStudio as {studio} and OriginalTitle (which is already there in the class) as {original-title}?

Probably also add original_title to the other 2 media types as well.

image

@xNinjaKittyx
Copy link

I also went ahead and edited the wiki. Apologies if I jumped ahead - https://github.com/Radiicall/jellyfin-rpc/wiki/Jellyfin

@hozarho hozarho marked this pull request as draft January 31, 2025 08:50
@hozarho
Copy link
Contributor Author

hozarho commented Jan 31, 2025

I was able to add {original-title} and {studio}.

Example

// [...]
"shows": {
  "display": {
    "details_text": "S{season-padded}E{episode-padded} - {title} {sep} {original-title}",
    "state_text": "{genres} {sep} {studio}",
    "image_text": "{show-title} ({year})"
  },
  "separator": "•"
},
// [...]

Result

image

Side Note

I tried to also add fields for production year of the show itself and original series title, but for now I don't know how to approach it any different way than applying a workaround to get userId by username from /Sessions and then getting item info via /Users/{userId}/Items/{itemId}, as apparently directly requesting GET /Items/{itemId} is not possible using authentication via API key. I think changing approach regarding authentication and adding workarounds is beyond the scope of this issue. Therefore, series-related fields are missing for now.

@hozarho hozarho marked this pull request as ready for review January 31, 2025 14:13
@Radiicall Radiicall requested a review from JustTemmie February 2, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants