Fix lint issues.
This commit is contained in:
parent
fa2452c037
commit
acdb635f7a
|
@ -14,7 +14,7 @@ sub onTextChanged()
|
|||
minChars = m.top.minChars
|
||||
if minChars = invalid then minChars = 50
|
||||
while m.top.text.Len() < minChars
|
||||
if addSpaceAfter then
|
||||
if addSpaceAfter
|
||||
m.top.text = m.top.text + Chr(160)
|
||||
else
|
||||
m.top.text = Chr(160) + m.top.text
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
function init() as void
|
||||
sub init() as void
|
||||
m.poster = m.top.findNode("poster")
|
||||
m.name = m.top.findNode("name")
|
||||
m.baseUrl = m.top.findNode("baseUrl")
|
||||
m.labels = m.top.findNode("labels")
|
||||
setTextColor(0)
|
||||
end function
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
sub itemContentChanged() as void
|
||||
server = m.top.itemContent
|
||||
|
||||
m.poster.uri = server.iconUrl
|
||||
m.name.text = server.name
|
||||
m.baseUrl.text = server.baseUrl
|
||||
end function
|
||||
end sub
|
||||
|
||||
function onFocusPercentChange(event)
|
||||
sub onFocusPercentChange(event)
|
||||
'print "focusPercentChange: " ; event.getData()
|
||||
setTextColor(event.getData())
|
||||
end function
|
||||
end sub
|
||||
|
||||
function setTextColor(percentFocused)
|
||||
sub setTextColor(percentFocused)
|
||||
white = "0xffffffff"
|
||||
black = "0x00000099"
|
||||
if percentFocused > .4 then
|
||||
if percentFocused > .4
|
||||
color = black
|
||||
else
|
||||
color = white
|
||||
|
@ -32,4 +32,4 @@ function setTextColor(percentFocused)
|
|||
for each child in children
|
||||
child.color = color
|
||||
end for
|
||||
end function
|
||||
end sub
|
||||
|
|
|
@ -51,7 +51,7 @@ function GetServersViaSSDP()
|
|||
|
||||
msg = Wait(maxTimeMs - elapsed, port)
|
||||
|
||||
if Type (msg) = "roSocketEvent" and msg.GetSocketId() = ssdp.GetId() and ssdp.IsReadable() then
|
||||
if Type (msg) = "roSocketEvent" and msg.GetSocketId() = ssdp.GetId() and ssdp.IsReadable()
|
||||
|
||||
recvStr = ssdp.ReceiveStr(4096)
|
||||
match = CreateObject("roRegex", "\r\nLocation:\s*(.*?)\s*\r\n", "i").Match(recvStr)
|
||||
|
@ -73,11 +73,11 @@ function GetServersViaSSDP()
|
|||
responseText = http.GetToString()
|
||||
xml = CreateObject("roXMLElement")
|
||||
'if we successfully parsed the response, process it
|
||||
if xml.Parse(responseText) then
|
||||
if xml.Parse(responseText)
|
||||
deviceNode = xml.GetNamedElementsCi("device")[0]
|
||||
manufacturer = deviceNode.GetNamedElementsCi("manufacturer").GetText()
|
||||
'only process jellyfin servers
|
||||
if lcase(manufacturer) = "jellyfin" then
|
||||
if lcase(manufacturer) = "jellyfin"
|
||||
'find the largest icon
|
||||
width = 0
|
||||
result = invalid
|
||||
|
@ -96,7 +96,7 @@ function GetServersViaSSDP()
|
|||
iconWidth: iconNode.GetNamedElementsCi("width")[0].GetText().ToInt(),
|
||||
iconHeight: iconNode.GetNamedElementsCi("height")[0].GetText().ToInt()
|
||||
}
|
||||
if baseUrl <> invalid and loopResult.iconWidth > width then
|
||||
if baseUrl <> invalid and loopResult.iconWidth > width
|
||||
result = loopResult
|
||||
end if
|
||||
end for
|
||||
|
|
|
@ -20,7 +20,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
|||
if not press then return true
|
||||
handled = true
|
||||
|
||||
if key = "OK" and m.serverPicker.hasFocus() then
|
||||
if key = "OK" and m.serverPicker.hasFocus()
|
||||
m.top.serverUrl = m.serverPicker.content.getChild(m.serverPicker.itemFocused).baseUrl
|
||||
m.submit.setFocus(true)
|
||||
'if the user pressed the down key and we are already at the last child of server picker, then change focus to the url textbox
|
||||
|
@ -47,12 +47,12 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
|||
return handled
|
||||
end function
|
||||
|
||||
function ScanForServers()
|
||||
sub ScanForServers()
|
||||
m.ssdpScanner = CreateObject("roSGNode", "SSDPTask")
|
||||
'run the task
|
||||
m.ssdpScanner.observeField("content", "ScanForServersComplete")
|
||||
m.ssdpScanner.control = "RUN"
|
||||
end function
|
||||
end sub
|
||||
|
||||
sub ScanForServersComplete(event)
|
||||
servers = event.getData()
|
||||
|
@ -66,7 +66,7 @@ sub ScanForServersComplete(event)
|
|||
m.spinner.visible = false
|
||||
end sub
|
||||
|
||||
function ShowKeyboard()
|
||||
sub ShowKeyboard()
|
||||
dialog = createObject("roSGNode", "KeyboardDialog")
|
||||
dialog.title = "Enter the server name or ip address"
|
||||
dialog.buttons = [tr("OK"), tr("Cancel")]
|
||||
|
@ -76,7 +76,7 @@ function ShowKeyboard()
|
|||
m.dialog = dialog
|
||||
|
||||
dialog.observeField("buttonSelected", "onDialogButton")
|
||||
end function
|
||||
end sub
|
||||
|
||||
function onDialogButton()
|
||||
d = m.dialog
|
||||
|
@ -89,5 +89,7 @@ function onDialogButton()
|
|||
else if button_text = tr("Cancel")
|
||||
m.dialog.close = true
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end if
|
||||
end function
|
||||
|
|
|
@ -24,7 +24,7 @@ function CreateServerGroup()
|
|||
if node = "submit"
|
||||
serverUrl = standardize_jellyfin_url(screen.serverUrl)
|
||||
'If this is a different server from what we know, reset username/password setting
|
||||
if get_setting("server") <> serverUrl then
|
||||
if get_setting("server") <> serverUrl
|
||||
set_setting("username", "")
|
||||
set_setting("password", "")
|
||||
end if
|
||||
|
@ -47,7 +47,8 @@ function CreateServerGroup()
|
|||
else if serverInfoResult.Error <> invalid and serverInfoResult.Error
|
||||
' If server redirected received, update the URL
|
||||
if serverInfoResult.UpdatedUrl <> invalid
|
||||
server_hostname.value = serverInfoResult.UpdatedUrl
|
||||
serverUrl = serverInfoResult.UpdatedUrl
|
||||
set_setting("server", serverUrl)
|
||||
end if
|
||||
' Display Error Message to user
|
||||
message = tr("Error: ")
|
||||
|
@ -66,6 +67,7 @@ function CreateServerGroup()
|
|||
|
||||
' Just hide it when done, in case we need to come back
|
||||
screen.visible = false
|
||||
return ""
|
||||
end function
|
||||
|
||||
function CreateUserSelectGroup(users = [])
|
||||
|
|
|
@ -31,11 +31,11 @@ end function
|
|||
function ticksToHuman(ticks as longinteger) as string
|
||||
totalSeconds = int(ticks / 10000000)
|
||||
hours = stri(int(totalSeconds / 3600)).trim()
|
||||
minutes = stri(int((totalSeconds - (val(hours)*3600))/60)).trim()
|
||||
seconds = stri(totalSeconds - (val(hours)*3600) - (val(minutes)*60)).trim()
|
||||
minutes = stri(int((totalSeconds - (val(hours) * 3600)) / 60)).trim()
|
||||
seconds = stri(totalSeconds - (val(hours) * 3600) - (val(minutes) * 60)).trim()
|
||||
if val(hours) > 0 and val(minutes) < 10 then minutes = "0" + minutes
|
||||
if val(seconds) < 10 then seconds = "0" + seconds
|
||||
r=""
|
||||
r = ""
|
||||
if val(hours) > 0 then r = hours + ":"
|
||||
r = r + minutes + ":" + seconds
|
||||
return r
|
||||
|
@ -70,10 +70,10 @@ end function
|
|||
|
||||
function div_ceiling(a as integer, b as integer) as integer
|
||||
if a < b then return 1
|
||||
if int(a/b) = a/b
|
||||
return a/b
|
||||
if int(a / b) = a / b
|
||||
return a / b
|
||||
end if
|
||||
return a/b + 1
|
||||
return a / b + 1
|
||||
end function
|
||||
|
||||
'Returns the item selected or -1 on backpress or other unhandled closure of dialog.
|
||||
|
@ -137,7 +137,7 @@ function show_dialog(message as string, options = [], defaultSelection = 0) as i
|
|||
end function
|
||||
|
||||
function message_dialog(message = "" as string)
|
||||
return show_dialog(message,["OK"])
|
||||
return show_dialog(message, ["OK"])
|
||||
end function
|
||||
|
||||
function option_dialog(options, message = "", defaultSelection = 0) as integer
|
||||
|
@ -151,13 +151,13 @@ end function
|
|||
function standardize_jellyfin_url(url as string)
|
||||
'Append default ports
|
||||
maxSlashes = 0
|
||||
if left(url, 8) = "https://" or left(url, 7) = "http://" then
|
||||
if left(url, 8) = "https://" or left(url, 7) = "http://"
|
||||
maxSlashes = 2
|
||||
end if
|
||||
'Check to make sure entry has no extra slashes before adding default ports.
|
||||
if Instr(0, url, "/") = maxSlashes then
|
||||
if url.len() > 5 and mid(url, url.len() - 4, 1) <> ":" and mid(url, url.len() - 5, 1) <> ":" then
|
||||
if left(url, 5) = "https" then
|
||||
if Instr(0, url, "/") = maxSlashes
|
||||
if url.len() > 5 and mid(url, url.len() - 4, 1) <> ":" and mid(url, url.len() - 5, 1) <> ":"
|
||||
if left(url, 5) = "https"
|
||||
url = url + ":8920"
|
||||
else
|
||||
url = url + ":8096"
|
||||
|
@ -165,7 +165,7 @@ function standardize_jellyfin_url(url as string)
|
|||
end if
|
||||
end if
|
||||
'Append http:// to server
|
||||
if left(url, 4) <> "http" then
|
||||
if left(url, 4) <> "http"
|
||||
url = "http://" + url
|
||||
end if
|
||||
return url
|
||||
|
|
Loading…
Reference in New Issue
Block a user