Linter Fixes: Use of unassigned variables

This commit is contained in:
Neil Burrows 2021-06-26 14:38:52 +01:00
parent 579475a34c
commit 13c2391ba7
9 changed files with 30 additions and 21 deletions

View File

@ -74,7 +74,7 @@ function getEndTime() as string
date.fromSeconds(date.asSeconds() + duration_s)
date.toLocalTime()
formatTime(date)
return formatTime(date)
end function
function getHistory() as string

View File

@ -77,7 +77,7 @@ function getEndTime() as string
date.fromSeconds(date.asSeconds() + duration_s)
date.toLocalTime()
formatTime(date)
return formatTime(date)
end function
function getHistory() as string

View File

@ -461,18 +461,19 @@ function LoginFlow(startOver = false as boolean)
if get_setting("server") = invalid then startOver = true
invalidServer = true
if not startOver then
' Show Connecting to Server spinner
dialog = createObject("roSGNode", "ProgressDialog")
dialog.title = tr("Connecting to Server")
m.scene.dialog = dialog
serverInfoResult = ServerInfo()
invalidServer = ServerInfo().Error
dialog.close = true
end if
if startOver or serverInfoResult.Error then
if startOver or invalidServer then
print "Get server details"
SendPerformanceBeacon("AppDialogInitiate") ' Roku Performance monitoring - Dialog Starting
serverSelection = CreateServerGroup()

View File

@ -91,6 +91,7 @@ function CreateServerGroup()
' Just hide it when done, in case we need to come back
group.visible = false
return ""
end function
function CreateUserSelectGroup(users = [])
@ -123,6 +124,7 @@ function CreateUserSelectGroup(users = [])
' Just hide it when done, in case we need to come back
group.visible = false
return ""
end function
function CreateSigninGroup(user = "")
@ -190,6 +192,7 @@ function CreateSigninGroup(user = "")
' Just hide it when done, in case we need to come back
group.visible = false
return ""
end function
function CreateHomeGroup()

View File

@ -95,7 +95,7 @@ function ItemMetaData(id as string)
else if data.type = "BoxSet"
tmp = CreateObject("roSGNode", "CollectionData")
tmp.image = PosterImage(data.id, imgParams)
tmp.json = item
tmp.json = data
return tmp
else if data.type = "Season"
tmp = CreateObject("roSGNode", "TVSeasonData")

View File

@ -5,6 +5,9 @@ function PlaystateUpdate(id, state as string, params = {})
url = "Sessions/Playing/Stopped"
else if state = "update"
url = "Sessions/Playing/Progress"
else
' Unknow State
return {}
end if
params = PlaystateDefaults(id, params)
resp = APIRequest(url)

View File

@ -5,6 +5,7 @@ function buildParams(params={} as Object) as string
param_array = []
for each field in params.items()
item = ""
if type(field.value) = "String" or type(field.value) = "roString"
item = field.key + "=" + req.escape(field.value.trim())
'item = field.key + "=" + field.value.trim()
@ -30,7 +31,8 @@ function buildParams(params={} as Object) as string
item = field.key + "=" + req.escape(field.value)
'item = field.key + "=" + field.value
end if
param_array.push(item)
if item <> "" then param_array.push(item)
end for
return param_array.join("&")

View File

@ -38,15 +38,15 @@ function AvailableUsers()
return users
end function
function PickUser(id as string)
sub PickUser(id as string)
this_user = invalid
for each user in AvailableUsers()
if user.id = id then this_user = user
end for
if this_user = invalid then return invalid
if this_user = invalid then return
set_setting("active_user", this_user.id)
set_setting("server", this_user.server)
end function
end sub
sub RemoveUser(id as string)
user = CreateObject("roSGNode", "UserData")

View File

@ -9,19 +9,19 @@ function registry_read(key, section=invalid)
return invalid
end function
function registry_write(key, value, section=invalid)
if section = invalid then return invalid
sub registry_write(key, value, section=invalid)
if section = invalid then return
reg = CreateObject("roRegistrySection", section)
reg.write(key, value)
reg.flush()
end function
end sub
function registry_delete(key, section=invalid)
if section = invalid then return invalid
sub registry_delete(key, section=invalid)
if section = invalid then return
reg = CreateObject("roRegistrySection", section)
reg.delete(key)
reg.flush()
end function
end sub
' "Jellyfin" registry accessors for the default global settings
@ -48,12 +48,12 @@ function get_user_setting(key, default=invalid)
return value
end function
function set_user_setting(key, value)
if get_setting("active_user") = invalid then return invalid
sub set_user_setting(key, value)
if get_setting("active_user") = invalid then return
registry_write(key, value, get_setting("active_user"))
end function
end sub
function unset_user_setting(key)
if get_setting("active_user") = invalid then return invalid
sub unset_user_setting(key)
if get_setting("active_user") = invalid then return
registry_delete(key, get_setting("active_user"))
end function
end sub