Add Rotten Tomato score to Movie Details

This commit is contained in:
thomabx 2020-04-04 11:18:41 -07:00
parent 68c9e186c6
commit 830b7b4532
2 changed files with 18 additions and 2 deletions

View File

@ -25,13 +25,25 @@ sub itemContentChanged()
setFieldText("communityRating", itemData.communityRating)
setFieldText("overview", itemData.overview)
if itemData.CriticRating <> invalid then
setFieldText("criticRatingLabel" , itemData.criticRating)
if itemData.CriticRating > 60 then
tomato = "pkg:/images/fresh.png"
else
tomato = "pkg:/images/rotten.png"
end if
m.top.findNode("criticRatingIcon").uri = tomato
else
m.top.findNode("infoGroup").removeChild(m.top.findNode("criticRatingGroup"))
end if
if type(itemData.RunTimeTicks) = "LongInteger"
setFieldText("runtime", stri(getRuntime()) + " mins")
setFieldText("ends-at", "Ends at " + getEndTime())
end if
if itemData.genres.count() > 0
setFieldText("genres", itemData.genres.join(", "))
setFieldText("genres", "Genres: " + itemData.genres.join(", "))
end if
director = invalid
for each person in itemData.people

View File

@ -6,7 +6,7 @@
translation="[250,150]"
width="400" height="600" />
<LayoutGroup layoutDirection="vert" translation="[455, 150]" itemSpacings="[25]">
<LayoutGroup layoutDirection="horiz" itemSpacings="[150]">
<LayoutGroup layoutDirection="horiz" itemSpacings="[100]" id="infoGroup">
<Label id="releaseYear" />
<Label id="runtime" />
<Label id="officialRating" />
@ -14,6 +14,10 @@
<Poster id="star" uri="pkg:/images/sharp_star_white_18dp.png" height="32" width="32" blendColor="#cb272a" />
<Label id="communityRating" />
</LayoutGroup>
<LayoutGroup layoutDirection="horiz" itemSpacings="[-5]" id="criticRatingGroup">
<Poster id="criticRatingIcon" height="32" width="32" />
<Label id="criticRatingLabel" />
</LayoutGroup>
<Label id="ends-at" />
</LayoutGroup>
<Label id="genres" />