jellyfin / jellyfin-roku

The Official Roku Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
449 stars 137 forks source link

Add option to remove community rating from episodes of TV shows #936

Closed dezchai closed 1 year ago

dezchai commented 1 year ago

Issue: Currently, there is no way to disable the star rating on an episode when viewed by the season.

Solution: Add an option in settings to disable the star rating.

Reason: Seeing the star rating of an episode before you watch it can spoil how good/bad an episode is (or if the episode is special) before watching.

I decided to give it a shot myself. This is my first time contributing to open source and working with brightscript. I sort of solved this issue with these code snippets.

Code:

In settings.json

{
"title": "TV Shows",
"description": "Options for TV Shows.",
"children": [
    {
        "title": "Blur Unwatched Episodes",
        "description": "If enabled, images of unwatched episodes will be blurred.",
        "settingName": "ui.tvshows.blurunwatched",
        "type": "bool",
        "default": "false"
    },
    {
        "title": "Skip Details for Single Seasons",
        "description": "If enabled, selecting a TV series with only one season will go straight to the episode list rather than the show details and season list.",
        "settingName": "ui.tvshows.goStraightToEpisodeListing",
        "type": "bool",
        "default": "false"
    },
    {
        "title":"Disable Community Rating for Episodes",
        "description": "If enabled, the star and community rating for TV show episodes will be removed. This is to prevent spoilers of an upcoming good/bad episode.",
        "settingName": "ui.tvshows.disableCommunityRating",
        "type":"bool",
        "default":"false"
    }
]
},

In TVListDetails.brs

if get_user_setting("ui.tvshows.disableCommunityRating") = "false"
    if isValid(itemData.communityRating)
        m.top.findNode("star").visible = true
        m.top.findNode("communityRating").text = str(int(itemData.communityRating * 10) / 10)
    else
        m.top.findNode("star").visible = false
    end if
else
    m.top.findNode("rating").visible = false
end if

The only thing missing is that it leaves a wide blank space after it's gone.

1hitsong commented 1 year ago

@dezchai Nice! You're 75% there! Submit it as a PR so you get credit as a contributor! We'll help you with the final details.