Fix an unreachable branch in the search function
The warning notification was never displayed because PeerTube class always returned a value even if no videos matching the keywords were found.
This commit is contained in:
parent
17f602da1a
commit
d87f3038d9
|
@ -323,7 +323,8 @@ class PeerTubeAddon():
|
|||
if not results:
|
||||
kodi.notif_warning(
|
||||
title="No videos found",
|
||||
message="No videos found matching the keywords.")
|
||||
message="No videos found matching the keywords '{}'"
|
||||
.format(keywords))
|
||||
return
|
||||
|
||||
# Extract the information of each video from the API response
|
||||
|
|
|
@ -198,14 +198,22 @@ class PeerTube:
|
|||
:param str keywords: keywords to seach for
|
||||
:param int start: index of the first video to display
|
||||
:return: the videos matching the keywords as returned by the REST API
|
||||
or None if there are no matches returned
|
||||
:rtype: dict
|
||||
"""
|
||||
# Build the parameters that will be send in the request
|
||||
# Build the parameters that will be sent in the request
|
||||
params = self._build_params(search=keywords,
|
||||
filter=self.filter,
|
||||
start=start)
|
||||
|
||||
return self._request(method="GET", url="search/videos", params=params)
|
||||
response = self._request(method="GET",
|
||||
url="search/videos",
|
||||
params=params)
|
||||
|
||||
if response["total"] == 0:
|
||||
return None
|
||||
else:
|
||||
return response
|
||||
|
||||
def set_instance(self, instance):
|
||||
"""Set the URL of the current instance with the right format
|
||||
|
|
Loading…
Reference in New Issue