Merge pull request #1453 from matty-r/searchFix

This commit is contained in:
Charles Ewert 2023-10-29 18:24:53 -04:00 committed by GitHub
commit 942a809cd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View File

@ -65,7 +65,7 @@ function getData()
"PlaylistsFolder": { "label": "Playlist", "count": 0 } "PlaylistsFolder": { "label": "Playlist", "count": 0 }
} }
for each item in itemData.searchHints for each item in itemData.Items
if content_types[item.type] <> invalid if content_types[item.type] <> invalid
content_types[item.type].count += 1 content_types[item.type].count += 1
end if end if
@ -86,10 +86,9 @@ sub addRow(data, title, type_filter)
itemData = m.top.itemData itemData = m.top.itemData
row = data.CreateChild("ContentNode") row = data.CreateChild("ContentNode")
row.title = title row.title = title
for each item in itemData.SearchHints for each item in itemData.Items
if item.type = type_filter if item.type = type_filter
row.appendChild(item) row.appendChild(item)
end if end if
end for end for
end sub end sub

View File

@ -37,11 +37,8 @@ end function
' Search across all libraries ' Search across all libraries
function searchMedia(query as string) function searchMedia(query as string)
' This appears to be done differently on the web now
' For each potential type, a separate query is done:
' varying item types, and artists, and people
if query <> "" if query <> ""
resp = APIRequest(Substitute("Search/Hints", m.global.session.user.id), { data = api.users.GetItemsByQuery(m.global.session.user.id, {
"searchTerm": query, "searchTerm": query,
"IncludePeople": true, "IncludePeople": true,
"IncludeMedia": true, "IncludeMedia": true,
@ -56,15 +53,14 @@ function searchMedia(query as string)
"limit": 100 "limit": 100
}) })
data = getJson(resp)
results = [] results = []
for each item in data.SearchHints for each item in data.Items
tmp = CreateObject("roSGNode", "SearchData") tmp = CreateObject("roSGNode", "SearchData")
tmp.image = PosterImage(item.id) tmp.image = PosterImage(item.id)
tmp.json = item tmp.json = item
results.push(tmp) results.push(tmp)
end for end for
data.SearchHints = results data.Items = results
return data return data
end if end if
return [] return []