Create fallback type if no results are found
This commit is contained in:
parent
577569a26f
commit
874eedecd7
|
@ -102,6 +102,7 @@ sub loadInitialItems()
|
|||
m.loadItemsTask.itemType = "Series"
|
||||
else if m.top.parentItem.collectionType = "music"
|
||||
m.loadItemsTask.itemType = "MusicArtist"
|
||||
m.loadItemsTask.fallbackType = "MusicAlbum"
|
||||
m.loadItemsTask.recursive = false
|
||||
else if m.top.parentItem.collectionType = "livetv"
|
||||
m.loadItemsTask.itemType = "LiveTV"
|
||||
|
|
|
@ -59,11 +59,12 @@ sub loadItems()
|
|||
|
||||
if data.TotalRecordCount <> invalid then m.top.totalRecordCount = data.TotalRecordCount
|
||||
|
||||
' When loading the music collection, if no artists are found, try searching by albums
|
||||
if m.top.collectionType = "music"
|
||||
if m.top.ItemType = "MusicArtist"
|
||||
if data.TotalRecordCount = 0
|
||||
m.top.ItemType = "MusicAlbum"
|
||||
' When loading a collection, if no results are found, try searching by fallback type
|
||||
if data.TotalRecordCount = 0
|
||||
if m.top.FallbackType <> ""
|
||||
' Ensure we didn't just search by the fallback type - prevent infinite loop
|
||||
if m.top.ItemType <> m.top.FallbackType
|
||||
m.top.ItemType = m.top.FallbackType
|
||||
loadItems()
|
||||
end if
|
||||
end if
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<field id="itemId" type="string" />
|
||||
<field id="startIndex" type="integer" value="0" />
|
||||
<field id="itemType" type="string" value="" />
|
||||
<field id="fallbackType" type="string" value="" />
|
||||
<field id="limit" type="integer" value="60" />
|
||||
<field id="metadata" type="assocarray" />
|
||||
<field id="sortField" type="string" value="SortName" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user