From 94465f36c8b5413e7b4ec2e2bacd2ed636113535 Mon Sep 17 00:00:00 2001 From: 1hitsong <3330318+1hitsong@users.noreply.github.com> Date: Sat, 4 Feb 2023 18:16:36 -0500 Subject: [PATCH] New User Setting: Disable Unwatched Episode Count --- components/ItemGrid/GridItem.brs | 10 ++++++---- components/ListPoster.brs | 10 ++++++---- components/home/HomeItem.brs | 10 ++++++---- components/tvshows/TVEpisodes.brs | 10 ++++++---- components/tvshows/TVShowDetails.brs | 10 ++++++---- components/tvshows/TVShowDetails.xml | 1 + locale/en_US/translations.ts | 11 +++++++++++ settings/settings.json | 19 +++++++++++++------ 8 files changed, 55 insertions(+), 26 deletions(-) diff --git a/components/ItemGrid/GridItem.brs b/components/ItemGrid/GridItem.brs index 77c7a6c3..9c0ebec1 100644 --- a/components/ItemGrid/GridItem.brs +++ b/components/ItemGrid/GridItem.brs @@ -43,10 +43,12 @@ sub itemContentChanged() m.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title else if itemData.type = "Series" - if itemData?.json?.UserData?.UnplayedItemCount <> invalid - if itemData.json.UserData.UnplayedItemCount > 0 - m.unplayedCount.visible = true - m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount + if get_user_setting("ui.tvshows.disableUnwatchedEpisodeCount", "false") = "false" + if itemData?.json?.UserData?.UnplayedItemCount <> invalid + if itemData.json.UserData.UnplayedItemCount > 0 + m.unplayedCount.visible = true + m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount + end if end if end if diff --git a/components/ListPoster.brs b/components/ListPoster.brs index ae04ef18..738d7402 100644 --- a/components/ListPoster.brs +++ b/components/ListPoster.brs @@ -57,10 +57,12 @@ sub itemContentChanged() as void itemData = m.top.itemContent m.title.text = itemData.title - if itemData?.json?.UserData?.UnplayedItemCount <> invalid - if itemData.json.UserData.UnplayedItemCount > 0 - m.unplayedCount.visible = true - m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount + if get_user_setting("ui.tvshows.disableUnwatchedEpisodeCount", "false") = "false" + if itemData?.json?.UserData?.UnplayedItemCount <> invalid + if itemData.json.UserData.UnplayedItemCount > 0 + m.unplayedCount.visible = true + m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount + end if end if end if diff --git a/components/home/HomeItem.brs b/components/home/HomeItem.brs index 42830c01..98e501c1 100644 --- a/components/home/HomeItem.brs +++ b/components/home/HomeItem.brs @@ -38,10 +38,12 @@ sub itemContentChanged() end if if LCase(itemData.type) = "series" - if itemData?.json?.UserData?.UnplayedItemCount <> invalid - if itemData.json.UserData.UnplayedItemCount > 0 - m.unplayedCount.visible = true - m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount + if get_user_setting("ui.tvshows.disableUnwatchedEpisodeCount", "false") = "false" + if itemData?.json?.UserData?.UnplayedItemCount <> invalid + if itemData.json.UserData.UnplayedItemCount > 0 + m.unplayedCount.visible = true + m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount + end if end if end if end if diff --git a/components/tvshows/TVEpisodes.brs b/components/tvshows/TVEpisodes.brs index fb69f9eb..5cb412f9 100644 --- a/components/tvshows/TVEpisodes.brs +++ b/components/tvshows/TVEpisodes.brs @@ -17,10 +17,12 @@ sub setSeasonLoading() end sub sub updateSeason() - if m.top.seasonData?.UserData?.UnplayedItemCount <> invalid - if m.top.seasonData.UserData.UnplayedItemCount > 0 - m.unplayedCount.visible = true - m.unplayedEpisodeCount.text = m.top.seasonData.UserData.UnplayedItemCount + if get_user_setting("ui.tvshows.disableUnwatchedEpisodeCount", "false") = "false" + if m.top.seasonData?.UserData?.UnplayedItemCount <> invalid + if m.top.seasonData.UserData.UnplayedItemCount > 0 + m.unplayedCount.visible = true + m.unplayedEpisodeCount.text = m.top.seasonData.UserData.UnplayedItemCount + end if end if end if diff --git a/components/tvshows/TVShowDetails.brs b/components/tvshows/TVShowDetails.brs index fc39755b..6e578814 100644 --- a/components/tvshows/TVShowDetails.brs +++ b/components/tvshows/TVShowDetails.brs @@ -15,10 +15,12 @@ sub itemContentChanged() item = m.top.itemContent itemData = item.json - if itemData?.UserData?.UnplayedItemCount <> invalid - if itemData.UserData.UnplayedItemCount > 0 - m.unplayedCount.visible = true - m.unplayedEpisodeCount.text = itemData.UserData.UnplayedItemCount + if get_user_setting("ui.tvshows.disableUnwatchedEpisodeCount", "false") = "false" + if itemData?.UserData?.UnplayedItemCount <> invalid + if itemData.UserData.UnplayedItemCount > 0 + m.unplayedCount.visible = true + m.unplayedEpisodeCount.text = itemData.UserData.UnplayedItemCount + end if end if end if diff --git a/components/tvshows/TVShowDetails.xml b/components/tvshows/TVShowDetails.xml index 7bdc7d8b..cf058566 100644 --- a/components/tvshows/TVShowDetails.xml +++ b/components/tvshows/TVShowDetails.xml @@ -33,5 +33,6 @@