Add version checker.

This commit is contained in:
Jimi 2022-05-31 23:05:54 -06:00 committed by Cody Robibero
parent bc7e3304c9
commit 40ece2d240
2 changed files with 29 additions and 3 deletions

View File

@ -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)

View File

@ -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