Merge pull request #955 from 1hitsong/SpeedUpHomeViewLoad

Make Home View load faster
This commit is contained in:
1hitsong 2023-01-26 17:35:38 -05:00 committed by GitHub
commit a0979b930c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -61,10 +61,13 @@ sub onLibrariesLoaded()
m.LoadLibrariesTask.content = []
' create My Media, Continue Watching, and Next Up rows
content = CreateObject("roSGNode", "ContentNode")
mediaRow = content.CreateChild("HomeRow")
mediaRow.title = tr("My Media")
continueRow = content.CreateChild("HomeRow")
continueRow.title = tr("Continue Watching")
nextUpRow = content.CreateChild("HomeRow")
nextUpRow.title = tr("Next Up >")
@ -113,10 +116,14 @@ sub onLibrariesLoaded()
m.LoadContinueTask.observeField("content", "updateContinueItems")
m.LoadContinueTask.control = "RUN"
m.LoadNextUpTask.observeField("content", "updateNextUpItems")
m.LoadNextUpTask.control = "RUN"
' Load the Favorites Data
m.LoadFavoritesTask.observeField("content", "updateFavoritesItems")
m.LoadFavoritesTask.control = "RUN"
' If we have Live TV access, load "On Now" data
if haveLiveTV
m.LoadOnNowTask.observeField("content", "updateOnNowItems")
@ -219,9 +226,6 @@ sub updateContinueItems()
homeRows.replaceChild(row, continueRowIndex)
end if
end if
m.LoadNextUpTask.observeField("content", "updateNextUpItems")
m.LoadNextUpTask.control = "RUN"
end sub
sub updateNextUpItems()
@ -274,7 +278,6 @@ sub updateNextUpItems()
m.global.app_loaded = true
end if
' create task nodes for "Latest In" rows
userConfig = m.top.userConfig
filteredLatest = filterNodeArray(m.libraryData, "id", userConfig.LatestItemsExcludes)

View File

@ -30,6 +30,7 @@ sub loadItems()
params["ParentId"] = m.top.itemId
params["EnableImageTypes"] = "Primary,Backdrop,Thumb"
params["ImageTypeLimit"] = 1
params["EnableTotalRecordCount"] = false
resp = APIRequest(url, params)
data = getJson(resp)
@ -53,6 +54,10 @@ sub loadItems()
params["SortOrder"] = "Descending"
params["ImageTypeLimit"] = 1
params["UserId"] = get_setting("active_user")
params["EnableRewatching"] = false
params["DisableFirstEpisode"] = false
params["limit"] = 24
params["EnableTotalRecordCount"] = false
maxDaysInNextUp = get_user_setting("ui.details.maxdaysnextup", "365")
if isValid(maxDaysInNextUp)
@ -64,9 +69,6 @@ sub loadItems()
dateCutoff.FromSeconds(dateToday.AsSeconds() - (maxDaysInNextUp * 86400))
params["NextUpDateCutoff"] = dateCutoff.ToISOString()
params["EnableRewatching"] = false
params["DisableFirstEpisode"] = false
params["limit"] = 24
end if
end if
@ -88,6 +90,7 @@ sub loadItems()
params["SortBy"] = "DatePlayed"
params["SortOrder"] = "Descending"
params["Filters"] = "IsResumable"
params["EnableTotalRecordCount"] = false
resp = APIRequest(url, params)
data = getJson(resp)
@ -109,6 +112,7 @@ sub loadItems()
params["Limit"] = 20
params["recursive"] = true
params["sortby"] = "random"
params["EnableTotalRecordCount"] = false
resp = APIRequest(url, params)
data = getJson(resp)