Merge pull request #882 from 1hitsong/ShowUnwatchedCount

Show unwatched count
This commit is contained in:
1hitsong 2022-12-29 08:30:03 -05:00 committed by GitHub
commit ee3b389c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 79 additions and 39 deletions

View File

@ -8,6 +8,9 @@ sub init()
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged") m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.itemText.translation = [0, m.itemPoster.height + 7] m.itemText.translation = [0, m.itemPoster.height + 7]
m.alwaysShowTitles = get_user_setting("itemgrid.alwaysShowTitles") = "true" m.alwaysShowTitles = get_user_setting("itemgrid.alwaysShowTitles") = "true"
@ -40,6 +43,13 @@ sub itemContentChanged()
m.itemIcon.uri = itemData.iconUrl m.itemIcon.uri = itemData.iconUrl
m.itemText.text = itemData.Title m.itemText.text = itemData.Title
else if itemData.type = "Series" 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
end if
end if
m.itemPoster.uri = itemData.PosterUrl m.itemPoster.uri = itemData.PosterUrl
m.itemIcon.uri = itemData.iconUrl m.itemIcon.uri = itemData.iconUrl
m.itemText.text = itemData.Title m.itemText.text = itemData.Title

View File

@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<component name="GridItem" extends="Group"> <component name="GridItem" extends="Group">
<children> <children>
<maskGroup id="posterMask" maskUri="pkg:/images/postermask.png" scaleRotateCenter="[145, 212.5]" scale="[0.85,0.85]" > <maskGroup id="posterMask" maskUri="pkg:/images/postermask.png" scaleRotateCenter="[145, 212.5]" scale="[0.85,0.85]">
<Poster id="backdrop" width="290" height="425" loadDisplayMode="scaleToZoom" uri="pkg:/images/white.9.png" /> <Poster id="backdrop" width="290" height="425" loadDisplayMode="scaleToZoom" uri="pkg:/images/white.9.png" />
<Poster id="itemPoster" width="290" height="425" loadDisplayMode="scaleToZoom" /> <Poster id="itemPoster" width="290" height="425" loadDisplayMode="scaleToZoom">
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[201, 0]">
<Label id="unplayedEpisodeCount" width="90" height="60" font="font:SmallestBoldSystemFont" horizAlign="center" vertAlign="center" />
</Rectangle>
</Poster>
<Poster id="itemIcon" width="50" height="50" translation="[230,10]" /> <Poster id="itemIcon" width="50" height="50" translation="[230,10]" />
<Label id="posterText" width="280" height="415" translation="[5,5]" horizAlign="center" vertAlign="center" ellipsizeOnBoundary="true" wrap="true" /> <Label id="posterText" width="280" height="415" translation="[5,5]" horizAlign="center" vertAlign="center" ellipsizeOnBoundary="true" wrap="true" />
</maskGroup> </maskGroup>

View File

@ -3,6 +3,8 @@ sub init()
m.staticTitle = m.top.findNode("staticTitle") m.staticTitle = m.top.findNode("staticTitle")
m.series = m.top.findNode("Series") m.series = m.top.findNode("Series")
m.poster = m.top.findNode("poster") m.poster = m.top.findNode("poster")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.backdrop = m.top.findNode("backdrop") m.backdrop = m.top.findNode("backdrop")
@ -55,6 +57,13 @@ sub itemContentChanged() as void
itemData = m.top.itemContent itemData = m.top.itemContent
m.title.text = itemData.title 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
end if
end if
if itemData.json.lookup("Type") = "Episode" and itemData.json.IndexNumber <> invalid if itemData.json.lookup("Type") = "Episode" and itemData.json.IndexNumber <> invalid
m.title.text = StrI(itemData.json.IndexNumber) + ". " + m.title.text m.title.text = StrI(itemData.json.IndexNumber) + ". " + m.title.text

View File

@ -2,32 +2,20 @@
<component name="ListPoster" extends="Group"> <component name="ListPoster" extends="Group">
<children> <children>
<Rectangle id="backdrop" /> <Rectangle id="backdrop" />
<ScrollingLabel id="Series" <ScrollingLabel id="Series" horizAlign="center" font="font:SmallSystemFont" repeatCount="0" visible="false" />
horizAlign="center" <Poster id="poster" translation="[2,0]" loadDisplayMode="scaleToFit">
font="font:SmallSystemFont" <Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[104, 0]">
repeatCount="0" <Label id="unplayedEpisodeCount" width="90" height="60" font="font:SmallestBoldSystemFont" horizAlign="center" vertAlign="center" />
visible="false" </Rectangle>
/> </Poster>
<Poster id="poster" translation="[2,0]" loadDisplayMode="scaleToFit" /> <ScrollingLabel id="title" horizAlign="center" font="font:SmallSystemFont" repeatCount="0" visible="false" />
<ScrollingLabel id="title" <Label id="staticTitle" horizAlign="center" font="font:SmallSystemFont" wrap="false" />
horizAlign="center"
font="font:SmallSystemFont"
repeatCount="0"
visible="false"
/>
<Label id="staticTitle"
horizAlign="center"
font="font:SmallSystemFont"
wrap="false"
/>
</children> </children>
<interface> <interface>
<field id="itemContent" type="node" onChange="itemContentChanged"/> <field id="itemContent" type="node" onChange="itemContentChanged"/>
<field id="itemWidth" type="integer" /> <field id="itemWidth" type="integer" />
<field id="itemHasFocus" type="boolean" onChange="focusChanged" /> <field id="itemHasFocus" type="boolean" onChange="focusChanged" />
<!-- mediatype -->
</interface> </interface>
<script type="text/brightscript" uri="ListPoster.brs" /> <script type="text/brightscript" uri="ListPoster.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" /> <script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
</component> </component>

View File

@ -48,10 +48,6 @@ sub setData()
imgParams = { "maxHeight": 261 } imgParams = { "maxHeight": 261 }
imgParams.Append({ "maxWidth": 464 }) imgParams.Append({ "maxWidth": 464 })
if datum.UserData.UnplayedItemCount > 0
imgParams["UnplayedCount"] = datum.UserData.UnplayedItemCount
end if
m.top.posterURL = ImageURL(datum.id, "Primary", imgParams) m.top.posterURL = ImageURL(datum.id, "Primary", imgParams)
' Add Wide Poster (Series Backdrop) ' Add Wide Poster (Series Backdrop)

View File

@ -7,6 +7,8 @@ sub init()
m.itemIcon = m.top.findNode("itemIcon") m.itemIcon = m.top.findNode("itemIcon")
m.itemTextExtra = m.top.findNode("itemTextExtra") m.itemTextExtra = m.top.findNode("itemTextExtra")
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged") m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.showProgressBarAnimation = m.top.findNode("showProgressBar") m.showProgressBarAnimation = m.top.findNode("showProgressBar")
m.showProgressBarField = m.top.findNode("showProgressBarField") m.showProgressBarField = m.top.findNode("showProgressBarField")
@ -24,19 +26,26 @@ sub itemContentChanged()
if itemData = invalid then return if itemData = invalid then return
itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JFContentItem" itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JFContentItem"
m.itemPoster.width = itemData.imageWidth m.itemPoster.width = itemData.imageWidth
m.itemText.maxWidth = itemData.imageWidth m.itemText.maxWidth = itemData.imageWidth
m.itemTextExtra.width = itemData.imageWidth m.itemTextExtra.width = itemData.imageWidth
m.itemTextExtra.visible = true m.itemTextExtra.visible = true
m.backdrop.width = itemData.imageWidth m.backdrop.width = itemData.imageWidth
if itemData.iconUrl <> invalid if itemData.iconUrl <> invalid
m.itemIcon.uri = itemData.iconUrl m.itemIcon.uri = itemData.iconUrl
end if 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
end if
end if
end if
' Format the Data based on the type of Home Data ' Format the Data based on the type of Home Data
if itemData.type = "CollectionFolder" or itemData.type = "UserView" or itemData.type = "Channel" if itemData.type = "CollectionFolder" or itemData.type = "UserView" or itemData.type = "Channel"
m.itemText.text = itemData.name m.itemText.text = itemData.name

View File

@ -3,12 +3,14 @@
<children> <children>
<Rectangle id="backdrop" width="464" height="261" translation="[8,5]" /> <Rectangle id="backdrop" width="464" height="261" translation="[8,5]" />
<Poster id="itemIcon" width="100" height="100" translation="[190,85]" loadDisplayMode="scaleToFit" /> <Poster id="itemIcon" width="100" height="100" translation="[190,85]" loadDisplayMode="scaleToFit" />
<Poster id="itemPoster" width="464" height="261" translation="[8,5]" loadDisplayMode="scaleToZoom" /> <Poster id="itemPoster" width="464" height="261" translation="[8,5]" loadDisplayMode="scaleToZoom">
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[375, 0]">
<Label id="unplayedEpisodeCount" width="90" height="60" font="font:SmallestBoldSystemFont" horizAlign="center" vertAlign="center" />
</Rectangle>
</Poster>
<Rectangle id="progressBackground" visible="false" color="0x00000098" width="464" height="8" translation="[8,260]"> <Rectangle id="progressBackground" visible="false" color="0x00000098" width="464" height="8" translation="[8,260]">
<Rectangle id="progress" color="#00a4dcFF" width="0" height="8" /> <Rectangle id="progress" color="#00a4dcFF" width="0" height="8" />
</Rectangle> </Rectangle>
<ScrollingLabel id="itemText" horizAlign="center" vertAlign="center" font="font:SmallBoldSystemFont" height="64" maxWidth="456" translation="[8,267]" repeatCount="0" /> <ScrollingLabel id="itemText" horizAlign="center" vertAlign="center" font="font:SmallBoldSystemFont" height="64" maxWidth="456" translation="[8,267]" repeatCount="0" />
<Label id="itemTextExtra" horizAlign="left" vertAlign="center" font="font:SmallBoldSystemFont" height="32" width="456" translation="[8,300]" visible="false" color="#777777FF" /> <Label id="itemTextExtra" horizAlign="left" vertAlign="center" font="font:SmallBoldSystemFont" height="32" width="456" translation="[8,300]" visible="false" color="#777777FF" />

View File

@ -6,6 +6,8 @@ sub init()
m.Random = m.top.findNode("Random") m.Random = m.top.findNode("Random")
m.tvEpisodeRow = m.top.findNode("tvEpisodeRow") m.tvEpisodeRow = m.top.findNode("tvEpisodeRow")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.rows.observeField("doneLoading", "updateSeason") m.rows.observeField("doneLoading", "updateSeason")
end sub end sub
@ -15,6 +17,13 @@ sub setSeasonLoading()
end sub end sub
sub updateSeason() 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
end if
end if
imgParams = { "maxHeight": 450, "maxWidth": 300 } imgParams = { "maxHeight": 450, "maxWidth": 300 }
m.poster.uri = ImageURL(m.top.seasonData.Id, "Primary", imgParams) m.poster.uri = ImageURL(m.top.seasonData.Id, "Primary", imgParams)
m.Random.visible = true m.Random.visible = true

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<component name="TVEpisodes" extends="JFGroup"> <component name="TVEpisodes" extends="JFGroup">
<children> <children>
<Poster id="seasonPoster" width="300" height="450" translation="[95,175]" /> <Poster id="seasonPoster" width="300" height="450" translation="[95,175]">
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[210, 0]">
<Label id="unplayedEpisodeCount" width="90" height="60" font="font:SmallestBoldSystemFont" horizAlign="center" vertAlign="center" />
</Rectangle>
</Poster>
<JFButton id="Random" text="Play Random" translation="[90, 640]" visible="false"></JFButton> <JFButton id="Random" text="Play Random" translation="[90, 640]" visible="false"></JFButton>
<TVEpisodeRowWithOptions id="picker" visible="true" /> <TVEpisodeRowWithOptions id="picker" visible="true" />
</children> </children>

View File

@ -3,6 +3,8 @@ sub init()
main = m.top.findNode("toplevel") main = m.top.findNode("toplevel")
main.translation = [96, 175] main.translation = [96, 175]
m.extrasSlider = m.top.findNode("tvSeasonExtras") m.extrasSlider = m.top.findNode("tvSeasonExtras")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
'm.extrasSlider.translation = [30,1014] 'm.extrasSlider.translation = [30,1014]
m.extrasSlider.visible = true m.extrasSlider.visible = true
end sub end sub
@ -13,6 +15,13 @@ sub itemContentChanged()
item = m.top.itemContent item = m.top.itemContent
itemData = item.json itemData = item.json
if itemData?.UserData?.UnplayedItemCount <> invalid
if itemData.UserData.UnplayedItemCount > 0
m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.UserData.UnplayedItemCount
end if
end if
m.top.findNode("tvshowPoster").uri = m.top.itemContent.posterURL m.top.findNode("tvshowPoster").uri = m.top.itemContent.posterURL
' Handle all "As Is" fields ' Handle all "As Is" fields

View File

@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<component name="TVShowDetails" extends="JFGroup"> <component name="TVShowDetails" extends="JFGroup">
<children> <children>
<LayoutGroup id="toplevel" layoutDirection="vert" itemSpacings="[-10]" > <LayoutGroup id="toplevel" layoutDirection="vert" itemSpacings="[-10]">
<LayoutGroup id="main_group" layoutDirection="horiz" itemSpacings="[15]" > <LayoutGroup id="main_group" layoutDirection="horiz" itemSpacings="[15]">
<Poster id="tvshowPoster" width="300" height="450" /> <Poster id="tvshowPoster" width="300" height="450">
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[210, 0]">
<Label id="unplayedEpisodeCount" width="90" height="60" font="font:SmallestBoldSystemFont" horizAlign="center" vertAlign="center" />
</Rectangle>
</Poster>
<LayoutGroup layoutDirection="vert" itemSpacings="[15]"> <LayoutGroup layoutDirection="vert" itemSpacings="[15]">
<LayoutGroup layoutDirection="horiz" itemSpacings="[150]"> <LayoutGroup layoutDirection="horiz" itemSpacings="[150]">
<Label id="releaseYear" /> <Label id="releaseYear" />

View File

@ -369,10 +369,6 @@ function TVSeasons(id as string)
results = [] results = []
for each item in data.Items for each item in data.Items
imgParams = { "AddPlayedIndicator": item.UserData.Played } imgParams = { "AddPlayedIndicator": item.UserData.Played }
if item.UserData.UnplayedItemCount > 0
param = { "UnplayedCount": item.UserData.UnplayedItemCount }
imgParams.Append(param)
end if
tmp = CreateObject("roSGNode", "TVEpisodeData") tmp = CreateObject("roSGNode", "TVEpisodeData")
tmp.image = PosterImage(item.id, imgParams) tmp.image = PosterImage(item.id, imgParams)
tmp.json = item tmp.json = item