Merge pull request #997 from sevenrats/episode-failure

Graceful episode playback failure
This commit is contained in:
1hitsong 2023-02-08 20:40:30 -05:00 committed by GitHub
commit 083a83a051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 14 deletions

View File

@ -123,11 +123,10 @@ sub onState(msg)
m.top.retryWithTranscoding = true ' If playback was not reported, retry with transcoding m.top.retryWithTranscoding = true ' If playback was not reported, retry with transcoding
else else
' If an error was encountered, Display dialog ' If an error was encountered, Display dialog
dialog = createObject("roSGNode", "Dialog") dialog = createObject("roSGNode", "PlaybackDialog")
dialog.title = tr("Error During Playback") dialog.title = tr("Error During Playback")
dialog.buttons = [tr("OK")] dialog.buttons = [tr("OK")]
dialog.message = tr("An error was encountered while playing this item.") dialog.message = tr("An error was encountered while playing this item.")
dialog.observeField("buttonSelected", "dialogClosed")
m.top.getScene().dialog = dialog m.top.getScene().dialog = dialog
end if end if
@ -208,11 +207,10 @@ sub bufferCheck(msg)
m.top.callFunc("refresh") m.top.callFunc("refresh")
else else
' If buffering has stopped Display dialog ' If buffering has stopped Display dialog
dialog = createObject("roSGNode", "Dialog") dialog = createObject("roSGNode", "PlaybackDialog")
dialog.title = tr("Error Retrieving Content") dialog.title = tr("Error Retrieving Content")
dialog.buttons = [tr("OK")] dialog.buttons = [tr("OK")]
dialog.message = tr("There was an error retrieving the data for this item from the server.") dialog.message = tr("There was an error retrieving the data for this item from the server.")
dialog.observeField("buttonSelected", "dialogClosed")
m.top.getScene().dialog = dialog m.top.getScene().dialog = dialog
' Stop playback and exit player ' Stop playback and exit player
@ -223,14 +221,6 @@ sub bufferCheck(msg)
end sub end sub
'
' Clean up on Dialog Closed
sub dialogClosed(msg)
sourceNode = msg.getRoSGNode()
sourceNode.unobserveField("buttonSelected")
sourceNode.close = true
end sub
function onKeyEvent(key as string, press as boolean) as boolean function onKeyEvent(key as string, press as boolean) as boolean
if key = "OK" and m.nextEpisodeButton.hasfocus() and not m.top.trickPlayBar.visible if key = "OK" and m.nextEpisodeButton.hasfocus() and not m.top.trickPlayBar.visible

View File

@ -0,0 +1,9 @@
function onKeyEvent(key as string, press as boolean) as boolean
if key = "OK"
m.top.close = true
return true
end if
return false
end function

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- A PlaybackDialog is a regular dialog, except it takes key releases -->
<!-- instead of presses so that key releases don't fall into other listeners -->
<component name="PlaybackDialog" extends="Dialog">
<script type="text/brightscript" uri="PlaybackDialog.brs" />
</component>

View File

@ -521,7 +521,11 @@ sub Main (args as dynamic) as void
else if node.showID = invalid else if node.showID = invalid
sceneManager.callFunc("popScene") sceneManager.callFunc("popScene")
else else
if video.errorMsg = ""
autoPlayNextEpisode(node.id, node.showID) autoPlayNextEpisode(node.id, node.showID)
else
sceneManager.callFunc("popScene")
end if
end if end if
end if end if
else if type(msg) = "roDeviceInfoEvent" else if type(msg) = "roDeviceInfoEvent"

View File

@ -46,7 +46,9 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -
end if end if
if m.videotype = "Episode" or m.videotype = "Series" if m.videotype = "Episode" or m.videotype = "Series"
if isValid(meta.json.RunTimeTicks)
video.runTime = (meta.json.RunTimeTicks / 10000000.0) video.runTime = (meta.json.RunTimeTicks / 10000000.0)
end if
video.content.contenttype = "episode" video.content.contenttype = "episode"
end if end if