diff --git a/resources/lib/addon.py b/resources/lib/addon.py index a3cefe9..82eabaa 100644 --- a/resources/lib/addon.py +++ b/resources/lib/addon.py @@ -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 diff --git a/resources/lib/peertube.py b/resources/lib/peertube.py index af88411..5c1a4ef 100644 --- a/resources/lib/peertube.py +++ b/resources/lib/peertube.py @@ -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