Add Photo to device profile and small update to GetBitRateLimit() (#1287)

This commit is contained in:
Charles Ewert 2023-08-20 12:48:15 -04:00 committed by GitHub
parent b5c7459c45
commit e2cfc05fbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 17 deletions

View File

@ -186,7 +186,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
video.SelectedSubtitle = subtitle_idx
if not fully_external
video.content = authorize_request(video.content)
video.content = authRequest(video.content)
end if
end sub

View File

@ -308,7 +308,7 @@ sub AddVideoContent(video as object, mediaSourceId as dynamic, audio_stream_idx
video.SelectedSubtitle = setupSubtitle(video, video.Subtitles, subtitle_idx)
if not fully_external
video.content = authorize_request(video.content)
video.content = authRequest(video.content)
end if
end sub

View File

@ -62,7 +62,7 @@ function APIRequest(url as string, params = {} as object) as dynamic
req = createObject("roUrlTransfer")
req.setUrl(full_url)
req = authorize_request(req)
req = authRequest(req)
' SSL cert
if serverURL.left(8) = "https://"
setCertificateAuthority(req)
@ -194,19 +194,21 @@ sub setCertificateAuthority(request as object) as void
request.setCertificatesFile("common:/certs/ca-bundle.crt")
end sub
function authorize_request(request)
auth = "MediaBrowser" + " Client=" + Chr(34) + "Jellyfin Roku" + Chr(34)
auth = auth + ", Device=" + Chr(34) + m.global.device.name + " (" + m.global.device.friendlyName + ")" + Chr(34)
auth = auth + ", Version=" + Chr(34) + m.global.app.version + Chr(34)
' Takes and returns a roUrlTransfer object after adding a Jellyfin "Authorization" header
function authRequest(request as object) as object
QUOTE = Chr(34)
auth = "MediaBrowser" + " Client=" + QUOTE + "Jellyfin Roku" + QUOTE
auth = auth + ", Device=" + QUOTE + m.global.device.name + " (" + m.global.device.friendlyName + ")" + QUOTE
auth = auth + ", Version=" + QUOTE + m.global.app.version + QUOTE
if m.global.session.user.id <> invalid
auth = auth + ", DeviceId=" + Chr(34) + m.global.device.id + Chr(34)
auth = auth + ", UserId=" + Chr(34) + m.global.session.user.id + Chr(34)
auth = auth + ", UserId=" + QUOTE + m.global.session.user.id + QUOTE
auth = auth + ", DeviceId=" + QUOTE + m.global.device.id + QUOTE
if m.global.session.user.authToken <> invalid
auth = auth + ", Token=" + Chr(34) + m.global.session.user.authToken + Chr(34)
auth = auth + ", Token=" + QUOTE + m.global.session.user.authToken + QUOTE
end if
else
auth = auth + ", DeviceId=" + Chr(34) + m.global.device.uuid + Chr(34)
auth = auth + ", DeviceId=" + QUOTE + m.global.device.uuid + QUOTE
end if
request.AddHeader("Authorization", auth)

View File

@ -7,7 +7,8 @@ function getDeviceCapabilities() as object
return {
"PlayableMediaTypes": [
"Audio",
"Video"
"Video",
"Photo"
],
"SupportedCommands": [],
"SupportsPersistentIdentifier": false,
@ -376,7 +377,7 @@ function GetBitRateLimit(codec as string)
"Condition": "LessThanEqual",
"Property": "VideoBitrate",
"Value": userSetLimit.ToStr(),
IsRequired: true
"IsRequired": true
}
else
' Some repeated values (e.g. same "40mbps" for several codecs)
@ -387,7 +388,7 @@ function GetBitRateLimit(codec as string)
"Condition": "LessThanEqual",
"Property": "VideoBitrate",
"Value": "10000000",
IsRequired: true
"IsRequired": true
}
else if codec = "AV1"
' Roku only supports AV1 up to 40Mpbs
@ -395,7 +396,7 @@ function GetBitRateLimit(codec as string)
"Condition": "LessThanEqual",
"Property": "VideoBitrate",
"Value": "40000000",
IsRequired: true
"IsRequired": true
}
else if codec = "H265"
' Roku only supports h265 up to 40Mpbs
@ -403,7 +404,7 @@ function GetBitRateLimit(codec as string)
"Condition": "LessThanEqual",
"Property": "VideoBitrate",
"Value": "40000000",
IsRequired: true
"IsRequired": true
}
else if codec = "VP9"
' Roku only supports VP9 up to 40Mpbs
@ -411,7 +412,7 @@ function GetBitRateLimit(codec as string)
"Condition": "LessThanEqual",
"Property": "VideoBitrate",
"Value": "40000000",
IsRequired: true
"IsRequired": true
}
end if
end if