Stop auto converting user settings to int. Update codebase to convert to int as needed

This commit is contained in:
Charles Ewert 2023-09-01 15:56:20 -04:00
parent 449cff412e
commit 464abddb2d
4 changed files with 22 additions and 28 deletions

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

@ -421,7 +421,8 @@ function getDeviceProfile() as object
if maxResSetting = "auto"
maxVideoHeight = m.global.device.videoHeight
maxVideoWidth = m.global.device.videoWidth
else if maxResSetting = "360"
else if maxResSetting <> "off"
if maxResSetting = "360"
maxVideoWidth = "480"
else if maxResSetting = "480"
maxVideoWidth = "640"
@ -434,6 +435,7 @@ function getDeviceProfile() as object
else if maxResSetting = "4320"
maxVideoWidth = "7680"
end if
end if
maxVideoHeightArray = {
"Condition": "LessThanEqual",
@ -878,7 +880,7 @@ end function
function GetBitRateLimit(codec as string) as object
if m.global.session.user.settings["playback.bitrate.maxlimited"] = true
userSetLimit = m.global.session.user.settings["playback.bitrate.limit"]
userSetLimit = m.global.session.user.settings["playback.bitrate.limit"].ToInt()
if isValid(userSetLimit) and type(userSetLimit) = "Integer" and userSetLimit > 0
userSetLimit *= 1000000
return {

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