Linter: Change any function that doesn't return a value to a sub

This commit is contained in:
Neil Burrows 2021-06-26 11:18:09 +01:00
parent 38fa383b4d
commit da54bc86fe
20 changed files with 95 additions and 97 deletions

View File

@ -29,7 +29,7 @@ sub init()
end sub
function updateTitle()
sub updateTitle()
leftSeperator = m.top.findNode("overlayLeftSeperator")
if m.top.title <> "" then
leftSeperator.visible = "true"
@ -39,9 +39,9 @@ function updateTitle()
title = m.top.findNode("overlayTitle")
title.text = m.top.title
resetTime()
end function
end sub
function updateUser()
sub updateUser()
rightSeperator = m.top.findNode("overlayRightSeperator")
if m.top.currentUser <> "" then
rightSeperator.visible = "true"
@ -50,9 +50,9 @@ function updateUser()
end if
user = m.top.findNode("overlayCurrentUser")
user.text = m.top.currentUser
end function
end sub
function updateTime()
sub updateTime()
if (m.currentMinutes + 1) > 59 then
m.currentHours = m.currentHours + 1
m.currentMinutes = 0
@ -61,9 +61,9 @@ function updateTime()
end if
updateTimeDisplay()
end function
end sub
function resetTime()
sub resetTime()
m.currentTimeTimer.control = "stop"
currentTime = CreateObject("roDateTime")
@ -75,9 +75,9 @@ function resetTime()
m.currentMinutes = currentTime.GetMinutes()
updateTimeDisplay()
end function
end sub
function updateTimeDisplay()
sub updateTimeDisplay()
overlayHours = m.top.findNode("overlayHours")
overlayMinutes = m.top.findNode("overlayMinutes")
overlayMeridian = m.top.findNode("overlayMeridian")
@ -112,9 +112,9 @@ function updateTimeDisplay()
else
overlayMinutes.text = m.currentMinutes
end if
end function
end sub
function updateOptions()
sub updateOptions()
optionText = m.top.findNode("overlayOptionsText")
optionStar = m.top.findNode("overlayOptionsStar")
if m.top.showOptions = true then
@ -124,4 +124,4 @@ function updateOptions()
optionText.visible = false
optionStar.visible = false
end if
end function
end sub

View File

@ -59,19 +59,19 @@ sub updateSize()
end sub
function itemContentChanged() as void
m.poster = m.top.findNode("poster")
itemData = m.top.itemContent
m.title.text = itemData.title
if itemData.json.lookup("Type") = "Episode" and itemData.json.IndexNumber <> invalid
m.title.text = StrI(itemData.json.IndexNumber) + ". " + m.title.text
end if
m.staticTitle.text = m.title.text
sub itemContentChanged() as void
m.poster = m.top.findNode("poster")
itemData = m.top.itemContent
m.title.text = itemData.title
if itemData.json.lookup("Type") = "Episode" and itemData.json.IndexNumber <> invalid
m.title.text = StrI(itemData.json.IndexNumber) + ". " + m.title.text
end if
m.staticTitle.text = m.title.text
m.poster.uri = itemData.posterUrl
m.poster.uri = itemData.posterUrl
updateSize()
end function
updateSize()
end sub
'
' Enable title scrolling based on item Focus

View File

@ -13,22 +13,20 @@ sub init()
end sub
function setData()
sub setData()
items = m.top.configItems
data = CreateObject("roSGNode", "ContentNode")
data.appendChildren(items)
m.top.content = data
end function
end sub
function onItemSelected()
print "HI"
sub onItemSelected()
i = m.top.itemSelected
itemField = m.top.content.getchild(i)
show_dialog(itemField)
end function
end sub
function onDialogButton()
d = m.dialog
@ -42,6 +40,7 @@ function onDialogButton()
dismiss_dialog()
return true
end if
return false
end function

View File

@ -3,21 +3,21 @@ sub setDataFromJSON()
loadFromJSON(json)
end sub
function loadFromJSON(json)
sub loadFromJSON(json)
m.top.id = json.User.id
m.top.username = json.User.name
m.top.token = json.AccessToken
end function
end sub
function loadFromRegistry(id as string)
sub loadFromRegistry(id as string)
m.top.id = id
m.top.username = get_user_setting("username")
m.top.token = get_user_setting("token")
end function
end sub
function saveToRegistry()
sub saveToRegistry()
set_user_setting("username", m.top.username)
set_user_setting("token", m.top.token)
@ -34,9 +34,9 @@ function saveToRegistry()
})
set_setting("available_users", formatJson(users))
end if
end function
end sub
function removeFromRegistry()
sub removeFromRegistry()
new_users = []
users = parseJson(get_setting("available_users", "[]"))
for each user in users
@ -44,7 +44,7 @@ function removeFromRegistry()
end for
set_setting("available_users", formatJson(new_users))
end function
end sub
function getPreference(key as string, default as string)
return get_user_setting("pref-" + key, default)
@ -54,10 +54,10 @@ function setPreference(key as string, value as string)
return set_user_setting("pref-" + key, value)
end function
function setActive()
sub setActive()
set_setting("active_user", m.top.id)
end function
end sub
function setServer(hostname as string)
sub setServer(hostname as string)
m.top.server = hostname
end function
end sub

View File

@ -3,10 +3,10 @@ sub init()
m.top.optionsAvailable = true
end sub
function refresh()
sub refresh()
m.top.findNode("homeRows").callFunc("updateHomeRows")
end function
end sub
function loadLibraries()
sub loadLibraries()
m.top.findNode("homeRows").callFunc("loadLibraries")
end function
end sub

View File

@ -26,9 +26,9 @@ sub init()
m.LoadNextUpTask.itemsToLoad = "nextUp"
end sub
function loadLibraries()
sub loadLibraries()
m.LoadLibrariesTask.control = "RUN"
end function
end sub
sub updateSize()
m.top.translation = [111, 180]
@ -91,17 +91,17 @@ sub onLibrariesLoaded()
m.LoadContinueTask.control = "RUN"
end sub
function updateHomeRows()
sub updateHomeRows()
m.LoadContinueTask.observeField("content", "updateContinueItems")
m.LoadContinueTask.control = "RUN"
end function
end sub
function updateContinueItems()
sub updateContinueItems()
itemData = m.LoadContinueTask.content
m.LoadContinueTask.unobserveField("content")
m.LoadContinueTask.content = []
if itemData = invalid then return false
if itemData = invalid then return
homeRows = m.top.content
continueRowIndex = getRowIndex("Continue Watching")
@ -135,14 +135,14 @@ function updateContinueItems()
m.LoadNextUpTask.observeField("content", "updateNextUpItems")
m.LoadNextUpTask.control = "RUN"
end function
end sub
function updateNextUpItems()
sub updateNextUpItems()
itemData = m.LoadNextUpTask.content
m.LoadNextUpTask.unobserveField("content")
m.LoadNextUpTask.content = []
if itemData = invalid then return false
if itemData = invalid then return
homeRows = m.top.content
nextUpRowIndex = getRowIndex("Next Up >")
@ -205,16 +205,16 @@ function updateNextUpItems()
loadLatest.control = "RUN"
end if
end for
end function
end sub
function updateLatestItems(msg)
sub updateLatestItems(msg)
itemData = msg.GetData()
node = msg.getRoSGNode()
node.unobserveField("content")
node.content = []
if itemData = invalid then return false
if itemData = invalid then return
homeRows = m.top.content
rowIndex = getRowIndex(tr("Latest in") + " " + node.metadata.title + " >")
@ -258,7 +258,7 @@ function updateLatestItems(msg)
homeRows.replaceChild(row, rowIndex)
end if
end if
end function
end sub
function getRowIndex(rowTitle as string)
rowIndex = invalid
@ -302,9 +302,9 @@ sub deleteFromSizeArray(rowIndex)
updateSizeArray([0, 0], rowIndex, "delete")
end sub
function itemSelected()
sub itemSelected()
m.top.selectedItem = m.top.content.getChild(m.top.rowItemSelected[0]).getChild(m.top.rowItemSelected[1])
end function
end sub
function onKeyEvent(key as string, press as boolean) as boolean
handled = false

View File

@ -1,10 +1,10 @@
function init()
sub init()
m.title = m.top.findNode("title")
m.description = m.top.findNode("description")
m.selectedIcon = m.top.findNode("selectedIcon")
end function
end sub
function itemContentChanged()
sub itemContentChanged()
m.title.text = m.top.itemContent.title
m.description.text = m.top.itemContent.description
@ -18,7 +18,7 @@ function itemContentChanged()
m.selectedIcon.uri = ""
end if
end function
end sub
'
'Scroll description if focused

View File

@ -1,4 +1,4 @@
function init()
sub init()
' backgroundUri must be set to an empty string before backgroundColor can be set
m.top.backgroundUri = ""
m.top.backgroundColor = "#000000"
@ -8,4 +8,4 @@ function init()
m.BounceAnimation = m.top.findNode("BounceAnimation")
m.BounceAnimation.control = "start" 'Start BounceAnimation
end function
end sub

View File

@ -74,7 +74,7 @@ function getData()
return data
end function
function addRow(data, title, type_filter)
sub addRow(data, title, type_filter)
itemData = m.top.itemData
row = data.CreateChild("ContentNode")
row.title = title
@ -83,4 +83,4 @@ function addRow(data, title, type_filter)
row.appendChild(item)
end if
end for
end function
end sub

View File

@ -33,12 +33,12 @@ sub updateSize()
m.top.rowItemSpacing = [ 20, 0 ]
end sub
function setupRows()
sub setupRows()
updateSize()
objects = m.top.objects
m.top.numRows = objects.items.count()
m.top.content = setData()
end function
end sub
function setData()
data = CreateObject("roSGNode", "ContentNode")

View File

@ -3,7 +3,7 @@ sub init()
m.title.text = tr("Loading...")
end sub
function itemContentChanged() as void
sub itemContentChanged()
item = m.top.itemContent
itemData = item.json
if itemData.indexNumber <> invalid then
@ -25,7 +25,7 @@ function itemContentChanged() as void
else
m.top.findNode("star").visible = false
end if
end function
end sub
function getRuntime() as integer
itemData = m.top.itemContent.json

View File

@ -1,4 +1,4 @@
function Main (args as Dynamic) as Void
sub Main (args as Dynamic) as Void
' If the Rooibos files are included in deployment, run tests
'bs:disable-next-line
@ -450,7 +450,7 @@ function Main (args as Dynamic) as Void
end if
end while
end function
end sub
function LoginFlow(startOver = false as boolean)
if m.scene <> invalid then

View File

@ -290,12 +290,11 @@ function CreateSearchPage()
return group
end function
function CreateSidePanel(buttons, options)
sub CreateSidePanel(buttons, options)
group = CreateObject("roSGNode", "OptionsSlider")
group.buttons = buttons
group.options = options
end function
end sub
function CreateVideoPlayerGroup(video_id, audio_stream_idx = 1)
' Video is Playing

View File

@ -226,13 +226,13 @@ sub ReportPlayback(video, state = "update" as string)
PlaystateUpdate(video.id, state, params)
end sub
function StopPlayback()
sub StopPlayback()
video = m.scene.focusedchild
video.control = "stop"
m.device.EnableAppFocusEvent(False)
video.findNode("playbackTimer").control = "stop"
ReportPlayback(video, "stop")
end function
end sub
function autoPlayNextEpisode(videoID as string, showID as string)
' use web client setting

View File

@ -40,9 +40,9 @@ function PlaystateDefaults(id="" as string, params={} as object)
return FormatJson(new_params)
end function
function deleteTranscode(id)
sub deleteTranscode(id)
devinfo = CreateObject("roDeviceInfo")
req = APIRequest("/Videos/ActiveEncodings", { "deviceID" : devinfo.getChannelClientID(), "PlaySessionId": id })
req.setRequest("DELETE")
postVoid(req)
end function
end sub

View File

@ -11,7 +11,7 @@ function UnmarkItemFavorite(id as String)
return getJson(resp)
end function
function MarkItemWatched(id as String)
sub MarkItemWatched(id as String)
date = CreateObject("roDateTime")
dateStr = stri(date.getYear()).trim()
dateStr += leftPad(stri(date.getMonth()).trim(), "0", 2)
@ -22,7 +22,7 @@ function MarkItemWatched(id as String)
url = Substitute("Users/{0}/PlayedItems/{1}", get_setting("active_user"), id)
APIRequest(url, {"DatePlayed": dateStr})
end function
end sub
function UnmarkItemWatched(id as String)
url = Substitute("Users/{0}/PlayedItems/{1}", get_setting("active_user"), id)

View File

@ -21,7 +21,7 @@ function AboutMe()
return getJson(resp)
end function
function SignOut()
sub SignOut()
if get_setting("active_user") <> invalid
unset_user_setting("token")
unset_setting("username")
@ -31,7 +31,7 @@ function SignOut()
m.overhang.currentUser = ""
m.overhang.showOptions = false
m.scene.unobserveField("optionsPressed")
end function
end sub
function AvailableUsers()
users = parseJson(get_setting("available_users", "[]"))
@ -48,13 +48,13 @@ function PickUser(id as string)
set_setting("server", this_user.server)
end function
function RemoveUser(id as string)
sub RemoveUser(id as string)
user = CreateObject("roSGNode", "UserData")
user.id = id
user.callFunc("removeFromRegistry")
if get_setting("active_user") = id then SignOut()
end function
end sub
function ServerInfo()
url = "System/Info/Public"

View File

@ -73,7 +73,7 @@ sub changeSubtitleDuringPlayback(newid)
end sub
function turnoffSubtitles()
sub turnoffSubtitles()
video = m.scene.focusedChild
current = video.SelectedSubtitle
video.SelectedSubtitle = -1
@ -85,7 +85,7 @@ function turnoffSubtitles()
AddVideoContent(video, video.audioIndex, -1, video.position * 10000000)
video.control = "play"
end if
end function
end sub
'Checks available subtitle tracks and puts subtitles in forced, default, and non-default/forced but preferred language at the top
function sortSubtitles(id as string, MediaStreams)

View File

@ -31,13 +31,13 @@ function get_setting(key, default=invalid)
return value
end function
function set_setting(key, value)
sub set_setting(key, value)
registry_write(key, value, "Jellyfin")
end function
end sub
function unset_setting(key)
sub unset_setting(key)
registry_delete(key, "Jellyfin")
end function
end sub
' User registry accessors for the currently active user

View File

@ -1,15 +1,15 @@
function initGlobal()
sub initGlobal()
if m.globals = invalid
m.globals = CreateObject("roAssociativeArray")
end if
end function
end sub
function getGlobal(key="" as String) as Dynamic
initGlobal()
return m.globals[key]
end function
function setGlobal(key="" as String, value=invalid as Dynamic)
sub setGlobal(key="" as String, value=invalid as Dynamic)
initGlobal()
m.globals[key] = value
end function
end sub