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

Add watched checkmark to Movies, Collections, TV Shows, Season list. Remove API generated checkmark #1547

Merged
merged 7 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions components/ItemGrid/GridItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ sub init()

m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.playedIndicator = m.top.findNode("playedIndicator")
m.checkmark = m.top.findNode("checkmark")
m.checkmark.width = 90
m.checkmark.height = 60

m.itemText.translation = [0, m.itemPoster.height + 7]

Expand Down Expand Up @@ -44,6 +48,10 @@ sub itemContentChanged()
if itemData = invalid then return

if itemData.type = "Movie"
if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.Played) and itemData.json.UserData.Played
m.playedIndicator.visible = true
end if

m.itemPoster.uri = itemData.PosterUrl
m.itemIcon.uri = itemData.iconUrl
m.itemText.text = itemData.Title
Expand All @@ -59,6 +67,9 @@ sub itemContentChanged()
end if
end if
end if
if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.Played) and itemData.json.UserData.Played = true
m.playedIndicator.visible = true
end if

m.itemPoster.uri = itemData.PosterUrl
m.itemIcon.uri = itemData.iconUrl
Expand Down
1 change: 1 addition & 0 deletions components/ItemGrid/GridItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" opacity=".99" translation="[201, 0]">
<Label id="unplayedEpisodeCount" width="90" height="60" font="font:MediumBoldSystemFont" horizAlign="center" vertAlign="center" />
</Rectangle>
<PlayedCheckmark id="playedIndicator" color="#00a4dcFF" width="90" height="60" opacity=".99" translation="[201, 0]" visible="false" />
</Poster>
<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" />
Expand Down
5 changes: 5 additions & 0 deletions components/ItemGrid/GridItemSmall.bs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sub init()
m.posterText.font.size = 30
m.title.font.size = 25
m.backdrop = m.top.findNode("backdrop")
m.playedIndicator = m.top.findNode("playedIndicator")

m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")

Expand Down Expand Up @@ -37,6 +38,10 @@ sub itemContentChanged()

if not isValid(itemData) then return

if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.Played) and itemData.json.UserData.Played
m.playedIndicator.visible = true
end if

m.itemPoster.uri = itemData.PosterUrl
m.posterText.text = itemData.title
m.title.text = itemData.title
Expand Down
1 change: 1 addition & 0 deletions components/ItemGrid/GridItemSmall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ScrollingLabel translation="[0,340]" id="title" horizAlign="center" font="font:SmallSystemFont" repeatCount="0" maxWidth="230" />
<Poster id="itemIcon" width="50" height="50" translation="[230,10]" />
<Label id="posterText" width="230" height="320" translation="[5,5]" horizAlign="center" vertAlign="center" ellipsizeOnBoundary="true" wrap="true" />
<PlayedCheckmark id="playedIndicator" color="#00a4dcFF" width="60" height="46" translation="[170, 15]" visible="false" />
</children>
<interface>
<field id="itemContent" type="node" onChange="itemContentChanged" />
Expand Down
8 changes: 8 additions & 0 deletions components/ListPoster.bs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ sub init()
m.poster = m.top.findNode("poster")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.playedIndicator = m.top.findNode("playedIndicator")
m.checkmark = m.top.findNode("checkmark")
m.checkmark.width = 90
m.checkmark.height = 60

m.backdrop = m.top.findNode("backdrop")

Expand Down Expand Up @@ -65,6 +69,10 @@ sub itemContentChanged() as void
end if
end if

if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.Played) and itemData.json.UserData.Played
m.playedIndicator.visible = true
end if

if itemData.json.lookup("Type") = "Episode" and isValid(itemData.json.IndexNumber)
m.title.text = StrI(itemData.json.IndexNumber) + ". " + m.title.text

Expand Down
3 changes: 2 additions & 1 deletion components/ListPoster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
<Rectangle id="backdrop" />
<ScrollingLabel id="Series" horizAlign="center" font="font:SmallSystemFont" repeatCount="0" visible="false" />
<Poster id="poster" translation="[2,0]" loadDisplayMode="scaleToFit">
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[104, 0]">
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[102, 0]">
<Label id="unplayedEpisodeCount" width="90" height="60" font="font:MediumBoldSystemFont" horizAlign="center" vertAlign="center" />
</Rectangle>
<PlayedCheckmark id="playedIndicator" color="#00a4dcFF" width="90" height="60" translation="[102, 0]" visible="false" />
</Poster>
<ScrollingLabel id="title" horizAlign="center" font="font:SmallSystemFont" repeatCount="0" visible="false" />
<Label id="staticTitle" horizAlign="center" font="font:SmallSystemFont" wrap="false" />
Expand Down
5 changes: 1 addition & 4 deletions source/api/Items.bs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ function ItemMetaData(id as string)
tmp.json = data
return tmp
else if data.type = "Episode"
' param = { "AddPlayedIndicator": data.UserData.Played }
' imgParams.Append(param)
tmp = CreateObject("roSGNode", "TVEpisodeData")
tmp.image = PosterImage(data.id, imgParams)
tmp.json = data
Expand Down Expand Up @@ -410,9 +408,8 @@ function TVSeasons(id as string) as dynamic

results = []
for each item in data.Items
imgParams = { "AddPlayedIndicator": item.UserData.Played }
tmp = CreateObject("roSGNode", "TVSeasonData")
tmp.image = PosterImage(item.id, imgParams)
tmp.image = PosterImage(item.id)
tmp.json = item
results.push(tmp)
end for
Expand Down