diff options
author | Mark Ryan <mark.d.ryan@intel.com> | 2013-06-11 22:02:38 +0200 |
---|---|---|
committer | Jussi Kukkonen <jussi.kukkonen@intel.com> | 2013-07-05 14:14:12 +0300 |
commit | e33d1e32628037bb65352fda73a6a1c15b68d660 (patch) | |
tree | 95650204ac61ecdbd59703d16f562fc12955b943 /src/msd | |
parent | dcb842a06858e0220a1fcc38b6c4aa5a48b15735 (diff) | |
download | dleyna-control-e33d1e32628037bb65352fda73a6a1c15b68d660.tar.gz |
[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 <mark.d.ryan@intel.com>
Diffstat (limited to 'src/msd')
-rw-r--r-- | src/msd/msd_search.py | 15 |
1 files 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__() |