Skip to content

Commit

Permalink
remove spinner when quickplay api queries return no results + fix rec…
Browse files Browse the repository at this point in the history
…ording library bug
  • Loading branch information
cewert committed Nov 25, 2023
1 parent 4043f3e commit b4d5a4e
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions source/utils/quickplay.bs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ namespace quickplay
photoPlayer.itemsArray = photoAlbumData.items
photoPlayer.itemIndex = 0
m.global.sceneManager.callfunc("pushScene", photoPlayer)
else
stopLoadingSpinner()
end if
end sub

Expand All @@ -103,6 +105,8 @@ namespace quickplay
})
if isValid(albumSongs) and isValidAndNotEmpty(albumSongs.items)
quickplay.pushToQueue(albumSongs.items)
else
stopLoadingSpinner()
end if
end sub

Expand All @@ -126,6 +130,8 @@ namespace quickplay

if isValid(artistSongs) and isValidAndNotEmpty(artistSongs.items)
quickplay.pushToQueue(artistSongs.items, true)
else
stopLoadingSpinner()
end if
end sub

Expand All @@ -142,6 +148,8 @@ namespace quickplay
})
if isValid(data) and isValidAndNotEmpty(data.Items)
quickplay.pushToQueue(data.items)
else
stopLoadingSpinner()
end if
end sub

Expand Down Expand Up @@ -197,6 +205,8 @@ namespace quickplay
if isValid(data) and isValidAndNotEmpty(data.Items)
' add all episodes found to a playlist
quickplay.pushToQueue(data.Items)
else
stopLoadingSpinner()
end if
end if
end if
Expand Down Expand Up @@ -240,6 +250,8 @@ namespace quickplay
end for
if m.global.queueManager.callFunc("getCount") > 1
m.global.queueManager.callFunc("toggleShuffle")
else
stopLoadingSpinner()
end if
end if
end sub
Expand Down Expand Up @@ -305,6 +317,8 @@ namespace quickplay
end if
end if
end if
else
stopLoadingSpinner()
end if
end sub

Expand Down Expand Up @@ -345,24 +359,26 @@ namespace quickplay

if m.global.queueManager.callFunc("getCount") > 1
m.global.queueManager.callFunc("toggleShuffle")
else
stopLoadingSpinner()
end if
end sub

' Quick Play A TVChannel
sub tvChannel(itemNode as object)
if not isValid(itemNode) or not isValid(itemNode.id) then return

stopLoadingSpinner()
group = CreateVideoPlayerGroup(itemNode.id)
stopLoadingSpinner()
m.global.sceneManager.callFunc("pushScene", group)
end sub

' Quick Play A Live Program
sub program(itemNode as object)
if not isValid(itemNode) or not isValid(itemNode.json) or not isValid(itemNode.json.ChannelId) then return

stopLoadingSpinner()
group = CreateVideoPlayerGroup(itemNode.json.ChannelId)
stopLoadingSpinner()
m.global.sceneManager.callFunc("pushScene", group)
end sub

Expand All @@ -383,6 +399,8 @@ namespace quickplay
if m.global.queueManager.callFunc("getCount") > 1
m.global.queueManager.callFunc("toggleShuffle")
end if
else
stopLoadingSpinner()
end if
end sub

Expand Down Expand Up @@ -451,6 +469,8 @@ namespace quickplay
quickplay.pushToQueue(folderData.items, true)
end if
end if
else
stopLoadingSpinner()
end if
end sub

Expand Down Expand Up @@ -484,6 +504,8 @@ namespace quickplay
end if
end for
quickplay.pushToQueue(movieList)
else
stopLoadingSpinner()
end if
else if collectionType = "music"
' get audio files from under this collection
Expand All @@ -501,6 +523,8 @@ namespace quickplay
print "songsData=", songsData
if isValid(songsData) and isValidAndNotEmpty(songsData.items)
quickplay.pushToQueue(songsData.Items, true)
else
stopLoadingSpinner()
end if
else if collectionType = "boxsets"
' get list of all boxsets inside
Expand Down Expand Up @@ -529,6 +553,8 @@ namespace quickplay
if isValid(boxsetData) and isValidAndNotEmpty(boxsetData.items)
' add all boxset items to queue
quickplay.pushToQueue(boxsetData.Items)
else
stopLoadingSpinner()
end if
end if
else if collectionType = "tvshows" or collectionType = "collectionfolder"
Expand All @@ -545,7 +571,15 @@ namespace quickplay
print "tvshowsData=", tvshowsData

if isValid(tvshowsData) and isValidAndNotEmpty(tvshowsData.items)
quickplay.multipleSeries(tvshowsData.items)
' the type of media returned from api may change.
if tvshowsData.items[0].Type = "Series"
quickplay.multipleSeries(tvshowsData.items)
else
' if first item is not a series, then assume they are all videos and/or episodes
quickplay.pushToQueue(tvshowsData.items)
end if
else
stopLoadingSpinner()
end if
else if collectionType = "musicvideos"
' get randomized list of videos inside
Expand All @@ -562,6 +596,8 @@ namespace quickplay
print "data=", data
if isValid(data) and isValidAndNotEmpty(data.items)
quickplay.pushToQueue(data.Items)
else
stopLoadingSpinner()
end if
else if collectionType = "homevideos"
' Photo library - items can be type video, photo, or photoAlbum
Expand All @@ -582,6 +618,8 @@ namespace quickplay
photoPlayer.itemsArray = folderData.items
photoPlayer.itemIndex = 0
m.global.sceneManager.callfunc("pushScene", photoPlayer)
else
stopLoadingSpinner()
end if
else
stopLoadingSpinner()
Expand Down Expand Up @@ -622,6 +660,8 @@ namespace quickplay
' validate api results
if isValid(playlistItems) and isValidAndNotEmpty(playlistItems.items)
quickplay.pushToQueue(playlistItems.items, true)
else
stopLoadingSpinner()
end if
end if
else if collectionType = "livetv"
Expand All @@ -644,6 +684,8 @@ namespace quickplay
print "myChannel=", myChannel
' play channel
quickplay.tvChannel(myChannel)
else
stopLoadingSpinner()
end if
else
stopLoadingSpinner()
Expand Down

0 comments on commit b4d5a4e

Please sign in to comment.