Added a test to make sure a 'search videos' request actually returned results
This commit is contained in:
parent
e7bbc94b35
commit
17352c6313
|
@ -153,7 +153,7 @@ class PeertubeAddon():
|
||||||
|
|
||||||
# Go back to main menu when user cancels
|
# Go back to main menu when user cancels
|
||||||
if not search:
|
if not search:
|
||||||
self.main_menu()
|
return None
|
||||||
|
|
||||||
# Create the PeerTube REST API request for searching videos
|
# Create the PeerTube REST API request for searching videos
|
||||||
req = '{0}/api/v1/search/videos?search={1}&count={2}&start={3}&sort={4}'.format(self.selected_inst, search, self.items_per_page, start, self.sort_method)
|
req = '{0}/api/v1/search/videos?search={1}&count={2}&start={3}&sort={4}'.format(self.selected_inst, search, self.items_per_page, start, self.sort_method)
|
||||||
|
@ -161,6 +161,11 @@ class PeertubeAddon():
|
||||||
# Send the query
|
# Send the query
|
||||||
results = self.query_peertube(req)
|
results = self.query_peertube(req)
|
||||||
|
|
||||||
|
# Exit directly when no result is found
|
||||||
|
if not results:
|
||||||
|
xbmcgui.Dialog().notification('No videos found', 'No videos found matching query', xbmcgui.NOTIFICATION_WARNING)
|
||||||
|
return None
|
||||||
|
|
||||||
# Create array of xmbcgui.ListItem's
|
# Create array of xmbcgui.ListItem's
|
||||||
listing = self.create_list(results, 'videos', start)
|
listing = self.create_list(results, 'videos', start)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue