From e33d1e32628037bb65352fda73a6a1c15b68d660 Mon Sep 17 00:00:00 2001 From: Mark Ryan Date: Tue, 11 Jun 2013 22:02:38 +0200 Subject: [Search] Partial fix for bug #38 - Removed a trailing space in front of the search string. This was causing problems for minidlna. - dleyna-control no longer issues a search if the search string is empty, i.e., images, audio and video are unselected. The old code was causing an invalid query to be sent which was generating an error in rygel can causing weird behaviour in minidlna. Signed-off-by: Mark Ryan --- src/msd/msd_search.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/msd/msd_search.py b/src/msd/msd_search.py index 22a766d..058232c 100644 --- a/src/msd/msd_search.py +++ b/src/msd/msd_search.py @@ -39,7 +39,7 @@ class SearchModel(GenericModel): q_buffer.write('(Artist contains "{0}"\ or DisplayName contains "{0}")'.format(query)) q_buffer.write(' and ') - q_buffer.write(' ( ') + q_buffer.write('( ') if images: q_buffer.write('Type derivedfrom "image" ') if videos: @@ -59,11 +59,14 @@ class SearchModel(GenericModel): return search_string def _fetch_items(self, start, count): - self.__root.search(self.__search_string, - start, count, - GenericModel.filter, - self.__sort_order.get_upnp_sort_order(), - self._on_reply, self._on_error) + if len(self.__search_string) > 0: + self.__root.search(self.__search_string, + start, count, + GenericModel.filter, + self.__sort_order.get_upnp_sort_order(), + self._on_reply, self._on_error) + else: + self._on_reply([], 0) def __init__(self, root, query, images, videos, music, sort_order): super(SearchModel, self).__init__() -- cgit v1.2.1