Code cleanup

This commit is contained in:
1hitsong 2022-11-20 20:18:23 -05:00
parent b9103be7c3
commit 119b14634e
3 changed files with 23 additions and 23 deletions

View File

@ -19,8 +19,9 @@ sub init()
m.nextEpisodeButton = m.top.findNode("nextEpisode")
m.nextEpisodeButton.text = tr("Next Episode")
m.nextEpisodeButton.setFocus(false)
m.shownextEpisodeButtonAnimation = m.top.findNode("shownextEpisodeButton")
m.hidenextEpisodeButtonAnimation = m.top.findNode("hidenextEpisodeButton")
m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton")
m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton")
end sub
' Event handler for when video content field changes
@ -35,9 +36,9 @@ end sub
'
' Runs Next Episode button animation and sets focus to button
sub shownextEpisode()
sub showNextEpisodeButton()
if not m.nextEpisodeButton.visible
m.shownextEpisodeButtonAnimation.control = "start"
m.showNextEpisodeButtonAnimation.control = "start"
m.nextEpisodeButton.setFocus(true)
m.nextEpisodeButton.visible = true
end if
@ -51,19 +52,21 @@ end sub
'
' Runs hide Next Episode button animation and sets focus back to video
sub hidenextEpisode()
'm.top.trickPlayBar.unobserveField("visible")
m.hidenextEpisodeButtonAnimation.control = "start"
sub hideNextEpisodeButton()
m.hideNextEpisodeButtonAnimation.control = "start"
m.nextEpisodeButton.setFocus(false)
m.top.setFocus(true)
end sub
sub handleNextEpisode()
' Dialog box is open
' Checks if we need to display the Next Episode button
sub checkTimeToDisplayNextEpisode()
if int(m.top.position) >= (m.top.runTime - 30)
shownextEpisode()
showNextEpisodeButton()
updateCount()
else
return
end if
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
m.nextEpisodeButton.visible = false
m.nextEpisodeButton.setFocus(false)
end if
@ -74,7 +77,7 @@ sub onPositionChanged()
' Check if dialog is open
m.dialog = m.top.getScene().findNode("dialogBackground")
if not isValid(m.dialog)
handleNextEpisode()
checkTimeToDisplayNextEpisode()
end if
end sub
@ -190,22 +193,21 @@ sub dialogClosed(msg)
sourceNode.close = true
end sub
function onKeyEvent(key as string, press as boolean) as boolean
if key = "OK" and m.nextEpisodeButton.hasfocus() and m.top.trickPlayMode = "play"
m.top.state = "finished"
hidenextEpisode()
hideNextEpisodeButton()
return true
else
'Hide Next Episode Button
m.nextEpisodeButton.visible = false
m.nextEpisodeButton.setFocus(false)
m.top.setFocus(true)
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
m.nextEpisodeButton.visible = false
m.nextEpisodeButton.setFocus(false)
m.top.setFocus(true)
end if
end if
if not press then return false
if key = "down"

View File

@ -33,10 +33,10 @@
<JFButton id="nextEpisode" opacity="0" textColor="#f0f0f0" focusedTextColor="#202020" focusFootprintBitmapUri="pkg:/images/option-menu-bg.9.png" focusBitmapUri="pkg:/images/white.9.png" translation="[1500, 900]" />
<!--animation for the play next episode button-->
<Animation id="shownextEpisodeButton" duration="1.0" repeat="false" easeFunction="inQuad">
<Animation id="showNextEpisodeButton" duration="1.0" repeat="false" easeFunction="inQuad">
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[0.0, .9]" fieldToInterp="nextEpisode.opacity" />
</Animation>
<Animation id="hidenextEpisodeButton" duration=".2" repeat="false" easeFunction="inQuad">
<Animation id="hideNextEpisodeButton" duration=".2" repeat="false" easeFunction="inQuad">
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[.9, 0]" fieldToInterp="nextEpisode.opacity" />
</Animation>
</children>

View File

@ -46,7 +46,6 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -
end if
if m.videotype = "Episode" or m.videotype = "Series"
'print (meta.json.RunTimeTicks / 10000000) / 60
video.runTime = (meta.json.RunTimeTicks / 10000000.0)
video.content.contenttype = "episode"
end if
@ -427,7 +426,6 @@ sub autoPlayNextEpisode(videoID as string, showID as string)
' setup new video node
nextVideo = CreateVideoPlayerGroup(data.Items[1].Id, invalid, 1, false, false)
' remove last videoplayer scene
m.global.sceneManager.callFunc("clearPreviousScene")
if nextVideo <> invalid
m.global.sceneManager.callFunc("pushScene", nextVideo)