mirror of
https://github.com/jellyfin/jellyfin-roku.git
synced 2024-11-27 00:10:43 +00:00
55 lines
1.4 KiB
Plaintext
55 lines
1.4 KiB
Plaintext
import "pkg:/source/api/baserequest.bs"
|
|
import "pkg:/source/utils/config.bs"
|
|
|
|
sub init()
|
|
m.top.functionName = "PlaystateUpdate"
|
|
end sub
|
|
|
|
sub PlaystateUpdate()
|
|
if m.top.status = "start"
|
|
url = "Sessions/Playing"
|
|
else if m.top.status = "stop" or m.top.status = "finished"
|
|
url = "Sessions/Playing/Stopped"
|
|
else if m.top.status = "update"
|
|
url = "Sessions/Playing/Progress"
|
|
else
|
|
' Unknown State
|
|
return
|
|
end if
|
|
params = PlaystateDefaults(m.top.params)
|
|
resp = APIRequest(url)
|
|
postJson(resp, params)
|
|
end sub
|
|
|
|
function PlaystateDefaults(params = {} as object)
|
|
new_params = {
|
|
'"CanSeek": false
|
|
'"Item": "{}", ' TODO!
|
|
'"NowPlayingQueue": "[]", ' TODO!
|
|
'"PlaylistItemId": "",
|
|
'"ItemId": id,
|
|
'"SessionId": "", ' TODO!
|
|
'"MediaSourceId": id,
|
|
'"AudioStreamIndex": 1,
|
|
'"SubtitleStreamIndex": 0,
|
|
"IsPaused": false,
|
|
'"IsMuted": false,
|
|
"PositionTicks": 0
|
|
'"PlaybackStartTimeTicks": 0,
|
|
'"VolumeLevel": 100,
|
|
'"Brightness": 100,
|
|
'"AspectRatio": "16x9",
|
|
'"PlayMethod": "DirectStream"
|
|
'"LiveStreamId": "",
|
|
'"PlaySessionId": "",
|
|
'"RepeatMode": "RepeatNone"
|
|
}
|
|
|
|
paramsArray = params.items()
|
|
for i = 0 to paramsArray.count() - 1
|
|
item = paramsArray[i]
|
|
new_params[item.key] = item.value
|
|
end for
|
|
return FormatJson(new_params)
|
|
end function
|