From 464abddb2d9780d4cc16ba9d700b9c4daf7563aa Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Fri, 1 Sep 2023 15:56:20 -0400 Subject: [PATCH] Stop auto converting user settings to int. Update codebase to convert to int as needed --- components/JFVideo.brs | 2 +- components/home/LoadItemsTask.brs | 2 +- source/utils/deviceCapabilities.brs | 28 +++++++++++++++------------- source/utils/session.bs | 18 +++++------------- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/components/JFVideo.brs b/components/JFVideo.brs index 788973d2..cebacb03 100644 --- a/components/JFVideo.brs +++ b/components/JFVideo.brs @@ -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") diff --git a/components/home/LoadItemsTask.brs b/components/home/LoadItemsTask.brs index ee42be1e..79bb2d38 100644 --- a/components/home/LoadItemsTask.brs +++ b/components/home/LoadItemsTask.brs @@ -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") diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 953c3f53..05f01a20 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -421,18 +421,20 @@ function getDeviceProfile() as object if maxResSetting = "auto" maxVideoHeight = m.global.device.videoHeight maxVideoWidth = m.global.device.videoWidth - else if maxResSetting = "360" - maxVideoWidth = "480" - else if maxResSetting = "480" - maxVideoWidth = "640" - else if maxResSetting = "720" - maxVideoWidth = "1280" - else if maxResSetting = "1080" - maxVideoWidth = "1920" - else if maxResSetting = "2160" - maxVideoWidth = "3840" - else if maxResSetting = "4320" - maxVideoWidth = "7680" + else if maxResSetting <> "off" + if maxResSetting = "360" + maxVideoWidth = "480" + else if maxResSetting = "480" + maxVideoWidth = "640" + else if maxResSetting = "720" + maxVideoWidth = "1280" + else if maxResSetting = "1080" + maxVideoWidth = "1920" + else if maxResSetting = "2160" + maxVideoWidth = "3840" + else if maxResSetting = "4320" + maxVideoWidth = "7680" + end if end if maxVideoHeightArray = { @@ -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 { diff --git a/source/utils/session.bs b/source/utils/session.bs index 4f2e2552..4f015751 100644 --- a/source/utils/session.bs +++ b/source/utils/session.bs @@ -234,25 +234,17 @@ 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 + if value = "true" + convertedValue = true + else if value = "false" + convertedValue = false end if tmpSettingArray[name] = convertedValue