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 @@
+
diff --git a/locale/en_US/translations.ts b/locale/en_US/translations.ts
index 60213edb..e5b0b3d6 100644
--- a/locale/en_US/translations.ts
+++ b/locale/en_US/translations.ts
@@ -1087,5 +1087,16 @@
GridTitle of an option - name of grid view
+
+
+
+ Disable Unwatched Episode Count
+ Settings Menu - Title for option
+
+
+
+ If enabled, the number of unwatched episodes in a series/season will be removed.
+ Settings Menu - Description for option
+
diff --git a/settings/settings.json b/settings/settings.json
index 6d4b2084..bb645058 100644
--- a/settings/settings.json
+++ b/settings/settings.json
@@ -224,16 +224,23 @@
"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",
+ "title": "Disable Community Rating for Episodes",
+ "description": "If enabled, the star and community rating for episodes of a TV show will be removed. This is to prevent spoilers of an upcoming good/bad episode.",
+ "settingName": "ui.tvshows.disableCommunityRating",
"type": "bool",
"default": "false"
},
{
- "title": "Disable Community Rating for Episodes",
- "description": "If enabled, the star and community rating for episodes of a TV show will be removed. This is to prevent spoilers of an upcoming good/bad episode.",
- "settingName": "ui.tvshows.disableCommunityRating",
+ "title": "Disable Unwatched Episode Count",
+ "description": "If enabled, the number of unwatched episodes in a series/season will be removed.",
+ "settingName": "ui.tvshows.disableUnwatchedEpisodeCount",
+ "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"
}