diff --git a/source/ShowScenes.brs b/source/ShowScenes.brs index 884ea576..039c15fd 100644 --- a/source/ShowScenes.brs +++ b/source/ShowScenes.brs @@ -190,9 +190,7 @@ function CreateSigninGroup(user = "") m.serverInfoResult = ServerInfo() end if ' Quick Connect only supported for server version 10.8+ right now... - regEx = CreateObject("roRegex", "\.", "") ' split on period - ver = regEx.split(m.serverInfoResult.Version) - if ver.Count() >= 2 and ver[0].toInt() >= 10 and ver[1].toInt() >= 8 + if versionChecker(m.serverInfoResult.Version, "10.8.0") ' Add option for Quick Connect quickConnect.text = tr("Quick Connect") quickConnect.observeField("buttonSelected", port) diff --git a/source/utils/misc.brs b/source/utils/misc.brs index bed54fbc..b393b1a5 100644 --- a/source/utils/misc.brs +++ b/source/utils/misc.brs @@ -167,3 +167,31 @@ function standardize_jellyfin_url(url as string) end if return url end function + +' +' Returns whether or not a version number (e.g. 10.7.7) is greater or equal +' to some minimum version alloed (e.g. 10.8.0) +function versionChecker(versionToCheck as string, minVersionAccepted as string) + leftHand = CreateObject("roLongInteger") + rightHand = CreateObject("roLongInteger") + + regEx = CreateObject("roRegex", "\.", "") + version = regEx.Split(versionToCheck) + if version.Count() < 3 + for i = version.Count() to 3 step 1 + version.AddTail("0") + end for + end if + + minVersion = regEx.Split(minVersionAccepted) + if minVersion.Count() < 3 + for i = minVersion.Count() to 3 step 1 + minVersion.AddTail("0") + end for + end if + + leftHand = (version[0].ToInt() * 10000) + (version[1].ToInt() * 100) + (version[2].ToInt() * 10) + rightHand = (minVersion[0].ToInt() * 10000) + (minVersion[1].ToInt() * 100) + (minVersion[2].ToInt() * 10) + + return leftHand >= rightHand +end function