getDeviceCapabilities() also prints the profile + some cleanup

This commit is contained in:
Charles Ewert 2023-10-30 23:34:42 -04:00
parent bccec61ece
commit 8aa325b93d
2 changed files with 16 additions and 15 deletions

View File

@ -29,12 +29,10 @@ sub Main (args as dynamic) as void
m.global.addFields({ audioPlayer: CreateObject("roSGNode", "AudioPlayer") })
app_start:
postDeviceProfile()
' First thing to do is validate the ability to use the API
if not LoginFlow() then return
' tell jellyfin server about device capabilities
' remove previous scenes from the stack
' remove login scenes from the stack
sceneManager.callFunc("clearScenes")
' load home page
@ -662,12 +660,18 @@ sub Main (args as dynamic) as void
' The audio codec capability has changed if true.
print "event.audioCodecCapabilityChanged = ", event.audioCodecCapabilityChanged
m.global.sceneManager.callFunc("postProfile")
postTask = createObject("roSGNode", "PostTask")
postTask.arrayData = getDeviceCapabilities()
postTask.apiUrl = "/Sessions/Capabilities/Full"
postTask.control = "RUN"
else if isValid(event.videoCodecCapabilityChanged)
' The video codec capability has changed if true.
print "event.videoCodecCapabilityChanged = ", event.videoCodecCapabilityChanged
m.global.sceneManager.callFunc("postProfile")
postTask = createObject("roSGNode", "PostTask")
postTask.arrayData = getDeviceCapabilities()
postTask.apiUrl = "/Sessions/Capabilities/Full"
postTask.control = "RUN"
else if isValid(event.appFocus)
' It is set to False when the System Overlay (such as the confirm partner button HUD or the caption control overlay) takes focus and True when the channel regains focus
print "event.appFocus = ", event.appFocus

View File

@ -1,11 +1,10 @@
import "pkg:/source/utils/misc.brs"
import "pkg:/source/api/baserequest.brs"
'Device Capabilities for Roku.
'This will likely need further tweaking
' Returns the Device Capabilities for Roku.
' Also prints out the device profile for debugging
function getDeviceCapabilities() as object
return {
deviceProfile = {
"PlayableMediaTypes": [
"Audio",
"Video",
@ -19,6 +18,10 @@ function getDeviceCapabilities() as object
"DeviceProfile": getDeviceProfile(),
"AppStoreUrl": "https://channelstore.roku.com/details/cc5e559d08d9ec87c5f30dcebdeebc12/jellyfin"
}
printDeviceProfile(deviceProfile)
return deviceProfile
end function
function getDeviceProfile() as object
@ -959,12 +962,6 @@ function removeDecimals(value as string) as string
return value
end function
' Post the deviceProfile to the server
sub postDeviceProfile()
profile = getDeviceCapabilities()
printDeviceProfile(profile)
end sub
' Print out the deviceProfile for debugging
sub printDeviceProfile(profile as object)
print "profile =", profile