Merge pull request #1299 from cewert/update-device-profile

This commit is contained in:
Charles Ewert 2023-09-11 09:50:43 -04:00 committed by GitHub
commit aaeceb7df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1082 additions and 259 deletions

View File

@ -188,7 +188,6 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
if not fully_external
video.content = authRequest(video.content)
end if
end sub
sub addVideoContentURL(video, mediaSourceId, audio_stream_idx, fully_external)
@ -406,9 +405,11 @@ function FindPreferredAudioStream(streams as dynamic) as integer
if preferredLanguage <> invalid
for i = 0 to streams.Count() - 1
if LCase(streams[i].Type) = "audio" and LCase(streams[i].Language) = LCase(preferredLanguage)
if LCase(streams[i].Type) = "audio"
if streams[i].Language <> invalid and LCase(streams[i].Language) = LCase(preferredLanguage)
return i
end if
end if
end for
end if

View File

@ -22,7 +22,7 @@ sub init()
m.nextEpisodeButton = m.top.findNode("nextEpisode")
m.nextEpisodeButton.text = tr("Next Episode")
m.nextEpisodeButton.setFocus(false)
m.nextupbuttonseconds = m.global.session.user.settings["playback.nextupbuttonseconds"]
m.nextupbuttonseconds = m.global.session.user.settings["playback.nextupbuttonseconds"].ToInt()
m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton")
m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton")

View File

@ -73,7 +73,7 @@ sub loadItems()
params["limit"] = 24
params["EnableTotalRecordCount"] = false
maxDaysInNextUp = m.global.session.user.settings["ui.details.maxdaysnextup"]
maxDaysInNextUp = m.global.session.user.settings["ui.details.maxdaysnextup"].ToInt()
if isValid(maxDaysInNextUp)
if maxDaysInNextUp > 0
dateToday = CreateObject("roDateTime")

View File

@ -1114,6 +1114,21 @@
<translation>Set how many seconds before the end of an episode the Next Episode button should appear. Set to 0 to disable.</translation>
<extracomment>Settings Menu - Description for option</extracomment>
</message>
<message>
<source>Choose your preferred audio codec when transcoding multichannel audio.</source>
<translation>Choose your preferred audio codec when transcoding multichannel audio.</translation>
<extracomment>Settings Menu - Description for option</extracomment>
</message>
<message>
<source>Force all transcodes to use DTS instead of the default EAC3. The device must support DTS for this setting to have an effect.</source>
<translation>Force all transcodes to use DTS instead of the default EAC3. The device must support DTS for this setting to have an effect.</translation>
<extracomment>Settings Menu - Description for option</extracomment>
</message>
<message>
<source>Audio Codec Support</source>
<translation>Audio Codec Support</translation>
<extracomment>Settings Menu - Title of option</extracomment>
</message>
<message>
<source>Direct playing</source>
<translation>Direct playing</translation>
@ -1123,5 +1138,75 @@
<translation>The source file is entirely compatible with this client and the session is receiving the file without modifications.</translation>
<extracomment>Direct play info box text in GetPlaybackInfoTask.brs</extracomment>
</message>
<message>
<source>Maximum Resolution</source>
<translation>Maximum Resolution</translation>
<extracomment>User Setting - Title</extracomment>
</message>
<message>
<source>Set the maximum resolution when playing video files on this device.</source>
<translation>Set the maximum resolution when playing video files on this device.</translation>
<extracomment>User Setting - Description</extracomment>
</message>
<message>
<source>Off - Attempt to play all resolutions</source>
<translation>Off - Attempt to play all resolutions</translation>
<extracomment>User Setting - Option title</extracomment>
</message>
<message>
<source>Auto - Use TV resolution</source>
<translation>Auto - Use TV resolution</translation>
<extracomment>User Setting - Option title</extracomment>
</message>
<message>
<source>Mode</source>
<translation>Mode</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Value</source>
<translation>Value</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Configure the maximum resolution when playing video files on this device.</source>
<translation>Configure the maximum resolution when playing video files on this device.</translation>
<extracomment>User Setting - Description</extracomment>
</message>
<message>
<source>Apply max resolution to all files or only transcoded files.</source>
<translation>Apply max resolution to all files or only transcoded files.</translation>
<extracomment>User Setting - Description</extracomment>
</message>
<message>
<source>All files</source>
<translation>All files</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Only transcoded files</source>
<translation>Only transcoded files</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Compatibility</source>
<translation>Compatibility</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Attempt to prevent playback failures.</source>
<translation>Attempt to prevent playback failures.</translation>
<extracomment>User Setting - Setting description</extracomment>
</message>
<message>
<source>Disable HEVC</source>
<translation>Disable HEVC</translation>
<extracomment>User Setting - Setting title</extracomment>
</message>
<message>
<source>Disable the HEVC codec on this device. This may improve playback for some devices (ultra).</source>
<translation>Disable the HEVC codec on this device. This may improve playback for some devices (ultra).</translation>
<extracomment>User Setting - Setting description</extracomment>
</message>
</context>
</TS>

View File

@ -3,6 +3,19 @@
"title": "Playback",
"description": "Settings relating to playback and supported codec and media types.",
"children": [
{
"title": "Audio Codec Support",
"description": "Choose your preferred audio codec when transcoding multichannel audio.",
"children": [
{
"title": "DTS",
"description": "Force all transcodes to use DTS instead of the default EAC3. The device must support DTS for this setting to have an effect.",
"settingName": "playback.forceDTS",
"type": "bool",
"default": "false"
}
]
},
{
"title": "Bitrate Limit",
"description": "Configure the maximum playback bitrate.",
@ -24,7 +37,85 @@
]
},
{
"title": "Codec Support",
"title": "Compatibility",
"description": "Attempt to prevent playback failures.",
"children": [
{
"title": "Disable HEVC",
"description": "Disable the HEVC codec on this device. This may improve playback for some devices (ultra).",
"settingName": "playback.compatibility.disablehevc",
"type": "bool",
"default": "false"
}
]
},
{
"title": "Maximum Resolution",
"description": "Configure the maximum resolution when playing video files on this device.",
"children": [
{
"title": "Mode",
"description": "Apply max resolution to all files or only transcoded files.",
"settingName": "playback.resolution.mode",
"type": "radio",
"default": "transcoding",
"options": [
{
"title": "All files",
"id": "everything"
},
{
"title": "Only transcoded files",
"id": "transcoding"
}
]
},
{
"title": "Value",
"description": "Set the maximum resolution when playing video files on this device.",
"settingName": "playback.resolution.max",
"type": "radio",
"default": "auto",
"options": [
{
"title": "Off - Attempt to play all resolutions",
"id": "off"
},
{
"title": "Auto - Use TV resolution",
"id": "auto"
},
{
"title": "360p",
"id": "360"
},
{
"title": "480p",
"id": "480"
},
{
"title": "720p",
"id": "720"
},
{
"title": "1080p",
"id": "1080"
},
{
"title": "4k",
"id": "2160"
},
{
"title": "8k",
"id": "4320"
}
]
}
]
},
{
"title": "Video Codec Support",
"description": "Enable or disable Direct Play support for certain codecs.",
"children": [
{
@ -51,7 +142,7 @@
]
},
{
"title": "Profile Level Support",
"title": "Video Profile Level Support",
"description": "Attempt Direct Play of potentially unsupported profile levels",
"children": [
{
@ -59,14 +150,14 @@
"description": "Attempt Direct Play for H.264 media with unsupported profile levels before falling back to transcoding if it fails.",
"settingName": "playback.tryDirect.h264ProfileLevel",
"type": "bool",
"default": "true"
"default": "false"
},
{
"title": "HEVC",
"description": "Attempt Direct Play for HEVC media with unsupported profile levels before falling back to transcoding if it fails.",
"settingName": "playback.tryDirect.hevcProfileLevel",
"type": "bool",
"default": "true"
"default": "false"
}
]
},

View File

@ -198,7 +198,7 @@ end sub
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 + ", Device=" + QUOTE + m.global.device.name + " (" + m.global.device.model + ")" + QUOTE
auth = auth + ", Version=" + QUOTE + m.global.app.version + QUOTE
if m.global.session.user.id <> invalid

File diff suppressed because it is too large Load Diff

View File

@ -40,17 +40,75 @@ end sub
' Save information from roDeviceInfo to m.global.device
sub SaveDeviceToGlobal()
deviceInfo = CreateObject("roDeviceInfo")
' remove special characters
regex = CreateObject("roRegex", "[^a-zA-Z0-9\ \-\_]", "")
filteredFriendly = regex.ReplaceAll(deviceInfo.getFriendlyName(), "")
' parse out serial
displayName = deviceInfo.getModelDisplayName()
deviceSerial = Mid(filteredFriendly, len(displayName) + 4)
' determine max playback resolution
' https://developer.roku.com/en-ca/docs/references/brightscript/interfaces/ifdeviceinfo.md#getvideomode-as-string
videoMode = deviceInfo.GetVideoMode()
iPos = Instr(1, videoMode, "i")
pPos = Instr(1, videoMode, "p")
videoHeight = invalid
videoWidth = invalid
refreshRate = "0"
bitDepth = 8
extraData = invalid
heightToWidth = {
"480": "720",
"576": "720",
"720": "1280",
"1080": "1920",
"2160": "3840",
"4320": "7680"
}
if iPos > 0 and pPos = 0
' videMode = 000i
videoHeight = mid(videoMode, 1, iPos - 1)
' save refresh rate
if Len(videoMode) > iPos
refreshRate = mid(videoMode, iPos + 1, 2)
end if
' save whats left of string
if Len(videoMode) > iPos + 2
extraData = mid(videoMode, iPos + 3)
end if
else if iPos = 0 and pPos > 0
' videMode = 000p
videoHeight = mid(videoMode, 1, pPos - 1)
' save refresh rate
if Len(videoMode) > pPos
refreshRate = mid(videoMode, pPos + 1, 2)
end if
' save whats left of string
if Len(videoMode) > pPos + 2
extraData = mid(videoMode, pPos + 3)
end if
else
'i and p not present in videoMode
print "ERROR parsing deviceInfo.GetVideoMode()"
end if
videoWidth = heightToWidth[videoHeight]
if videoHeight = "2160" and extraData = "b10"
bitDepth = 10
else if videoHeight = "4320"
bitDepth = 12
end if
m.global.addFields({
device: {
id: deviceInfo.getChannelClientID(),
uuid: deviceInfo.GetRandomUUID(),
name: deviceInfo.getModelDisplayName(),
name: displayName,
friendlyName: filteredFriendly,
model: deviceInfo.GetModel(),
modelType: deviceInfo.GetModelType(),
modelDetails: deviceInfo.GetModelDetails(),
serial: deviceSerial,
osVersion: deviceInfo.GetOSVersion(),
locale: deviceInfo.GetCurrentLocale(),
clockFormat: deviceInfo.GetClockFormat(),
@ -58,7 +116,12 @@ sub SaveDeviceToGlobal()
hasVoiceRemote: deviceInfo.HasFeature("voice_remote"),
displayType: deviceInfo.GetDisplayType(),
displayMode: deviceInfo.GetDisplayMode()
displayMode: deviceInfo.GetDisplayMode(),
videoMode: videoMode,
videoHeight: videoHeight,
videoWidth: videoWidth,
videoRefresh: StrToI(refreshRate),
videoBitDepth: bitDepth
}
})
end sub

View File

@ -382,3 +382,13 @@ sub stopLoadingSpinner()
m.scene.dialog.close = true
end if
end sub
' Check if a specific value is inside of an array
function arrayHasValue(arr as object, value as dynamic) as boolean
for each entry in arr
if entry = value
return true
end if
end for
return false
end function

View File

@ -234,26 +234,18 @@ namespace session
end sub
' Saves the user setting to the global session.
' This also converts strings to boolean and integer as necessary before saving to global session
' This also converts strings to boolean as necessary before saving to global session
sub Save(name as string, value as string)
if name = invalid or value = invalid then return
tmpSettingArray = m.global.session.user.settings
convertedValue = value
' convert to int
valueInteger = value.ToInt()
if value = "0" or valueInteger <> 0
convertedValue = valueInteger
end if
' convert to boolean
if type(value) = "String"
if value = "true"
convertedValue = true
else if value = "false"
convertedValue = false
end if
end if
tmpSettingArray[name] = convertedValue