Merge branch 'master' into feature/jf-478-audio-track-for-tv-shows

This commit is contained in:
Jimi 2022-04-28 20:09:03 -06:00
commit 4e17a8a868
7 changed files with 76 additions and 29 deletions

View File

@ -5,6 +5,8 @@ sub init()
m.backdrop = m.top.findNode("backdrop") m.backdrop = m.top.findNode("backdrop")
m.deviceInfo = CreateObject("roDeviceInfo")
' Randmomise the background colors ' Randmomise the background colors
posterBackgrounds = m.global.constants.poster_bg_pallet posterBackgrounds = m.global.constants.poster_bg_pallet
m.backdrop.color = posterBackgrounds[rnd(posterBackgrounds.count()) - 1] m.backdrop.color = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
@ -68,6 +70,13 @@ sub focusChanged()
m.staticTitle.visible = false m.staticTitle.visible = false
m.title.visible = true m.title.visible = true
' text to speech for accessibility
if m.deviceInfo.IsAudioGuideEnabled() = true
txt2Speech = CreateObject("roTextToSpeech")
txt2Speech.Flush()
txt2Speech.Say(m.title.text)
end if
else else
m.title.repeatCount = 0 m.title.repeatCount = 0
m.staticTitle.visible = true m.staticTitle.visible = true

View File

@ -0,0 +1,31 @@
sub init()
m.posterImg = m.top.findNode("posterImg")
m.name = m.top.findNode("pLabel")
m.role = m.top.findNode("subTitle")
m.deviceInfo = CreateObject("roDeviceInfo")
end sub
sub showContent()
if m.top.itemContent <> invalid
cont = m.top.itemContent
m.name.text = cont.labelText
m.name.maxWidth = cont.imageWidth
m.role.Width = cont.imageWidth
m.posterImg.uri = cont.posterUrl
m.posterImg.width = cont.imageWidth
m.role.Text = cont.subTitle
else
m.role.text = tr("Unknown")
m.posterImg.uri = "pkg:/images/baseline_person_white_48dp.png"
end if
end sub
sub focusChanged()
if m.deviceInfo.IsAudioGuideEnabled() = true
txt2Speech = CreateObject("roTextToSpeech")
txt2Speech.Flush()
txt2Speech.Say(m.name.text)
txt2Speech.Say(m.role.text)
end if
end sub

View File

@ -2,31 +2,9 @@
<component name="ExtrasItem" extends="JFGroup"> <component name="ExtrasItem" extends="JFGroup">
<interface> <interface>
<field id="itemContent" type="node" onChange="showContent" /> <field id="itemContent" type="node" onChange="showContent" />
<field id="itemHasFocus" type="boolean" onChange="focusChanged" />
</interface> </interface>
<script type="text/brightscript"> <script type="text/brightscript" uri="ExtrasItem.brs" />
<![CDATA[
function init() as void
m.posterImg = m.top.findNode("posterImg")
m.name = m.top.findNode("pLabel")
m.role = m.top.findNode("subTitle")
end function
sub showContent()
if m.top.itemContent <> Invalid
cont = m.top.itemContent
m.name.text = cont.labelText
m.name.maxWidth = cont.imageWidth
m.role.Width = cont.imageWidth
m.posterImg.uri = cont.posterUrl
m.posterImg.width = cont.imageWidth
m.role.Text = cont.subTitle
else
m.role.text = "Who??"
m.posterImg.uri = "pkg:/images/baseline_person_white_48dp.png"
end if
end sub
]]>
</script>
<children> <children>
<LayoutGroup layoutDirection="vert" > <LayoutGroup layoutDirection="vert" >
<Poster id="posterImg" width="234" height="300" translation="[8,243]" failedBitmapUri="pkg:/images/baseline_person_white_48dp.png" /> <Poster id="posterImg" width="234" height="300" translation="[8,243]" failedBitmapUri="pkg:/images/baseline_person_white_48dp.png" />

View File

@ -2,6 +2,8 @@ sub init()
m.title = m.top.findNode("title") m.title = m.top.findNode("title")
m.title.text = tr("Loading...") m.title.text = tr("Loading...")
m.options = m.top.findNode("tvListOptions") m.options = m.top.findNode("tvListOptions")
m.overview = m.top.findNode("overview")
m.deviceInfo = CreateObject("roDeviceInfo")
end sub end sub
sub itemContentChanged() sub itemContentChanged()
@ -12,9 +14,9 @@ sub itemContentChanged()
else else
indexNumber = "" indexNumber = ""
end if end if
m.top.findNode("title").text = indexNumber + item.title m.title.text = indexNumber + item.title
m.top.findNode("poster").uri = item.posterURL m.top.findNode("poster").uri = item.posterURL
m.top.findNode("overview").text = item.overview m.overview.text = item.overview
if type(itemData.RunTimeTicks) = "LongInteger" if type(itemData.RunTimeTicks) = "LongInteger"
m.top.findNode("runtime").text = stri(getRuntime()).trim() + " mins" m.top.findNode("runtime").text = stri(getRuntime()).trim() + " mins"
@ -87,3 +89,15 @@ function getEndTime() as string
return formatTime(date) return formatTime(date)
end function end function
sub focusChanged()
if m.top.itemHasFocus = true
' text to speech for accessibility
if m.deviceInfo.IsAudioGuideEnabled() = true
txt2Speech = CreateObject("roTextToSpeech")
txt2Speech.Flush()
txt2Speech.Say(m.title.text)
txt2Speech.Say(m.overview.text)
end if
end if
end sub

View File

@ -29,6 +29,7 @@
<interface> <interface>
<field id="itemContent" type="node" onChange="itemContentChanged"/> <field id="itemContent" type="node" onChange="itemContentChanged"/>
<field id="selectedAudioStreamIndex" type="integer" /> <field id="selectedAudioStreamIndex" type="integer" />
<field id="itemHasFocus" type="boolean" onChange="focusChanged" />
</interface> </interface>
<script type="text/brightscript" uri="TVListDetails.brs" /> <script type="text/brightscript" uri="TVListDetails.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" /> <script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />

View File

@ -135,17 +135,22 @@ function round(f as float) as integer
end function end function
function onKeyEvent(key as string, press as boolean) as boolean function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
overview = m.top.findNode("overview")
topGrp = m.top.findNode("seasons") topGrp = m.top.findNode("seasons")
bottomGrp = m.top.findNode("extrasGrid") bottomGrp = m.top.findNode("extrasGrid")
if key = "down" and overview.hasFocus()
if key = "down" and topGrp.isinFocusChain() topGrp.setFocus(true)
return true
else if key = "down" and topGrp.hasFocus()
bottomGrp.setFocus(true) bottomGrp.setFocus(true)
m.top.findNode("VertSlider").reverse = false m.top.findNode("VertSlider").reverse = false
m.top.findNode("extrasFader").reverse = false m.top.findNode("extrasFader").reverse = false
m.top.findNode("pplAnime").control = "start" m.top.findNode("pplAnime").control = "start"
return true return true
else if key = "up" and bottomGrp.isinFocusChain() else if key = "up" and bottomGrp.hasFocus()
if bottomGrp.itemFocused = 0 if bottomGrp.itemFocused = 0
m.top.findNode("VertSlider").reverse = true m.top.findNode("VertSlider").reverse = true
m.top.findNode("extrasFader").reverse = true m.top.findNode("extrasFader").reverse = true
@ -153,6 +158,10 @@ function onKeyEvent(key as string, press as boolean) as boolean
topGrp.setFocus(true) topGrp.setFocus(true)
return true return true
end if end if
else if key = "up" and topGrp.hasFocus()
overview.setFocus(true)
return true
end if end if
return false return false
end function end function

View File

@ -431,6 +431,11 @@
<translation>Not found</translation> <translation>Not found</translation>
<extracomment>Title of message box when the requested content is not found on the server</extracomment> <extracomment>Title of message box when the requested content is not found on the server</extracomment>
</message> </message>
<message>
<source>Unknown</source>
<translation>Unknown</translation>
<extracomment>Title for a cast member for which we have no information for</extracomment>
</message>
<message> <message>
<source>The requested content does not exist on the server</source> <source>The requested content does not exist on the server</source>
<translation>The requested content does not exist on the server</translation> <translation>The requested content does not exist on the server</translation>