2019-03-08 03:47:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
|
|
<component name="MovieItemDetailScene" extends="Scene">
|
|
|
|
<children>
|
|
|
|
<LayoutGroup layoutDirection="horiz">
|
|
|
|
<Poster id="moviePoster"
|
|
|
|
translation="[150,150]"
|
|
|
|
width="196" height="294" />
|
2019-03-08 06:22:16 +00:00
|
|
|
<LayoutGroup layoutDirection="vert" translation="[355, 150]" itemSpacings="[0, 10]">
|
2019-03-08 03:47:10 +00:00
|
|
|
<Label id="title" />
|
2019-03-08 06:22:16 +00:00
|
|
|
<LayoutGroup layoutDirection="horiz" itemSpacings="[10, 0]">
|
2019-03-08 03:47:10 +00:00
|
|
|
<Label id="releaseYear" />
|
|
|
|
<Label id="runtime" />
|
2019-03-08 06:22:16 +00:00
|
|
|
<Label id="officialRating" />
|
|
|
|
<Label id="communityRating" />
|
2019-03-08 03:47:10 +00:00
|
|
|
<Label id="ends-at" />
|
|
|
|
</LayoutGroup>
|
|
|
|
<Label id="genres" />
|
|
|
|
<Label id="director" />
|
|
|
|
<Label id="video_codec" />
|
|
|
|
<Label id="audio_codec" />
|
|
|
|
<Label id="buttons" />
|
2019-03-08 06:22:16 +00:00
|
|
|
<Label id="tagline" />
|
2019-03-08 03:47:10 +00:00
|
|
|
<Label id="overview" />
|
|
|
|
|
|
|
|
</LayoutGroup>
|
|
|
|
</LayoutGroup>
|
|
|
|
</children>
|
|
|
|
<interface>
|
|
|
|
<field id="itemJson" type="associativearray" onChange="itemContentChanged" />
|
|
|
|
</interface>
|
|
|
|
<script type="text/brightscript" uri="pkg:/source/config.brs" />
|
|
|
|
<script type="text/brightscript" uri="pkg:/source/JellyfinAPI.brs" />
|
|
|
|
<script type="text/brightscript">
|
|
|
|
<![CDATA[
|
|
|
|
sub init()
|
|
|
|
|
|
|
|
|
|
|
|
end sub
|
|
|
|
|
2019-03-08 06:22:16 +00:00
|
|
|
sub setFieldText(field as string, value)
|
|
|
|
node = m.top.findNode(field)
|
|
|
|
if node = invalid then return
|
|
|
|
|
|
|
|
node.text = value
|
|
|
|
end sub
|
|
|
|
|
|
|
|
function round(f as Float) as Integer
|
|
|
|
' BrightScript only has a "floor" round
|
|
|
|
' This compares floor to floor + 1 to find which is closer
|
|
|
|
m = int(f)
|
|
|
|
n = m + 1
|
|
|
|
x = abs(f - m)
|
|
|
|
y = abs(f - n)
|
|
|
|
if y > x
|
|
|
|
return m
|
|
|
|
else
|
|
|
|
return n
|
|
|
|
end if
|
|
|
|
end function
|
|
|
|
|
2019-03-08 03:47:10 +00:00
|
|
|
sub itemContentChanged()
|
|
|
|
itemData = m.top.itemJson
|
|
|
|
|
|
|
|
m.top.findNode("moviePoster").uri = ImageURL(itemData.id)
|
2019-03-08 06:22:16 +00:00
|
|
|
setFieldText("title", itemData.name)
|
|
|
|
setFieldText("releaseYear", itemData.productionYear)
|
|
|
|
|
|
|
|
' A tick is .1ms, so 1/10,000,000 for ticks to seconds,
|
|
|
|
' then 1/60 for seconds to minutess... 1/600,000,000
|
|
|
|
duration = round(itemData.RunTimeTicks / 600000000.0)
|
|
|
|
setFieldText("runtime", stri(duration) + " mins")
|
|
|
|
|
|
|
|
setFieldText("officialRating", itemData.officialRating)
|
|
|
|
setFieldText("communityRating", str(itemData.communityRating))
|
|
|
|
|
|
|
|
date = CreateObject("roDateTime")
|
|
|
|
duration_s = int(itemData.RunTimeTicks / 10000000.0)
|
|
|
|
date.fromSeconds(date.asSeconds() + duration_s)
|
|
|
|
date.toLocalTime()
|
|
|
|
d = date.toISOString()
|
|
|
|
' TODO - not full ISO format
|
|
|
|
setFieldText("ends-at", "Ends at " + d)
|
|
|
|
|
|
|
|
if itemData.genres.count() > 0
|
|
|
|
setFieldText("genres", itemData.genres.join(", "))
|
|
|
|
end if
|
|
|
|
director = invalid
|
|
|
|
for each person in itemData.people
|
|
|
|
if person.type = "Director"
|
|
|
|
director = person.name
|
|
|
|
exit for
|
|
|
|
end if
|
|
|
|
end for
|
|
|
|
if director <> invalid
|
|
|
|
setFieldText("director", "Director: " + director)
|
|
|
|
end if
|
|
|
|
setFieldText("video_codec", "Video: " + itemData.mediaStreams[0].displayTitle)
|
|
|
|
setFieldText("audio_codec", "Audio: " + itemData.mediaStreams[1].displayTitle)
|
|
|
|
' TODO - cmon now. these are buttons, not words
|
|
|
|
setFieldText("buttons", "Play, Delete, Watched, Favorite, ...")
|
|
|
|
if itemData.taglines.count() > 0
|
|
|
|
setFieldText("tagline", itemData.taglines[0])
|
|
|
|
end if
|
|
|
|
setFieldText("overview", itemData.overview)
|
2019-03-08 03:47:10 +00:00
|
|
|
end sub
|
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
</component>
|