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

Fix distorted TV episode posters. Add client-side progress bar and played indicator. #922

Merged
merged 8 commits into from
Jan 27, 2023
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
19 changes: 19 additions & 0 deletions components/tvshows/TVListDetails.brs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ sub init()

m.rating = m.top.findnode("rating")
m.infoBar = m.top.findnode("infoBar")
m.progressBackground = m.top.findNode("progressBackground")
m.progressBar = m.top.findnode("progressBar")
m.playedIndicator = m.top.findNode("playedIndicator")
m.checkmark = m.top.findNode("checkmark")
m.checkmark.font.size = 35
end sub

sub itemContentChanged()
Expand Down Expand Up @@ -59,6 +64,20 @@ sub itemContentChanged()
m.top.findNode("star").visible = false
end if

' Add checkmark in corner (if applicable)
if isValid(itemData?.UserData?.Played) and itemData.UserData.Played = true
m.playedIndicator.visible = true
end if

' Add progress bar on bottom (if applicable)
if isValid(itemData?.UserData?.PlayedPercentage) and itemData?.UserData?.PlayedPercentage > 0
m.progressBackground.width = m.poster.width
m.progressBackground.visible = true
progressWidthInPixels = int(m.progressBackground.width * itemData.UserData.PlayedPercentage / 100)
m.progressBar.width = progressWidthInPixels
m.progressBar.visible = true
end if

videoIdx = invalid
audioIdx = invalid

Expand Down
11 changes: 9 additions & 2 deletions components/tvshows/TVListDetails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
<component name="TVListDetails" extends="Group">
<children>
<LayoutGroup id="toplevel" layoutDirection="vert" itemSpacings="[40]">
<LayoutGroup id="main_group" layoutDirection="horiz" itemSpacings="[30]">
<Poster id="poster" width="350" height="300" />
<LayoutGroup id="main_group" layoutDirection="horiz" itemSpacings="[30]">
<Poster id="poster" width="350" height="300" loadDisplayMode="scaleToZoom">
<Rectangle id="playedIndicator" color="#00a4dcFF" width="60" height="46" visible="false" translation="[290, 0]">
<Label id="checkmark" width="60" height="42" font="font:SmallestBoldSystemFont" horizAlign="center" vertAlign="bottom" text="✓"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's bump up the font size on the check to 35.

Here's what it looks like.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to override font size here? Couldn't find a way to do that, so I've set it over in the TVListDetails.brs init funciton.

</Rectangle>
<Rectangle id="progressBackground" visible="false" color="0x00000098" width="350" height="16" translation="[0,286]">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make the height 8 to match the homepage bar height?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a height of 8, the row selector blocks a good chunk of the progress bar. Do we want to stick with this height, or try to move/resize the progress bar on selection?

Copy link
Contributor Author

@ApexArray ApexArray Dec 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

<Rectangle id="progressBar" color="#00a4dcFF" width="0" height="16" visible="false"/>
</Rectangle>
</Poster>
<LayoutGroup id="text" layoutDirection="vert" itemSpacings="[15]">
<!-- Using poster of 1 length to get spacing. Not successful with adding translation to title -->
<Poster id="null" height="1" />
Expand Down
6 changes: 1 addition & 5 deletions source/api/Items.brs
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,7 @@ function TVEpisodes(show_id as string, season_id as string)
data = getJson(resp)
results = []
for each item in data.Items
imgParams = { "AddPlayedIndicator": item.UserData.Played, "maxWidth": 400, "maxheight": 250 }
ApexArray marked this conversation as resolved.
Show resolved Hide resolved
if item.UserData.PlayedPercentage <> invalid
param = { "PercentPlayed": item.UserData.PlayedPercentage }
imgParams.Append(param)
end if
imgParams = { "maxWidth": 400, "maxheight": 250 }
tmp = CreateObject("roSGNode", "TVEpisodeData")
tmp.image = PosterImage(item.id, imgParams)
if tmp.image <> invalid
Expand Down