From 8c765b5cd7a5f86b952744221504e85fa9f2271b Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Fri, 15 May 2020 22:34:49 -0600 Subject: [PATCH] Fixed some issues with search --- setup.cfg | 1 + sublime/adapters/manager.py | 2 +- sublime/adapters/subsonic/adapter.py | 4 ++-- sublime/ui/albums.py | 2 +- tests/adapter_tests/filesystem_adapter_tests.py | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index f3896cd..7598b92 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,3 +58,4 @@ addopts = --cov=sublime --cov-report html --cov-report term + --no-cov-on-fail diff --git a/sublime/adapters/manager.py b/sublime/adapters/manager.py index 8fe2ae7..681d5fe 100644 --- a/sublime/adapters/manager.py +++ b/sublime/adapters/manager.py @@ -968,7 +968,7 @@ class AdapterManager: return sorted( it, key=lambda x: AdapterManager._strip_ignored_articles( - use_ground_truth_adapter, key(x) + use_ground_truth_adapter, key(x).lower() ), ) diff --git a/sublime/adapters/subsonic/adapter.py b/sublime/adapters/subsonic/adapter.py index b9d8854..18ccaeb 100644 --- a/sublime/adapters/subsonic/adapter.py +++ b/sublime/adapters/subsonic/adapter.py @@ -520,9 +520,9 @@ class SubsonicAdapter(Adapter): def search(self, query: str) -> API.SearchResult: result = self._get_json(self._make_url("search3"), query=query).search_result if not result: - return API.SearchResult() + return API.SearchResult(query) - search_result = API.SearchResult() + search_result = API.SearchResult(query) search_result.add_results("albums", result.album) search_result.add_results("artists", result.artist) search_result.add_results("songs", result.song) diff --git a/sublime/ui/albums.py b/sublime/ui/albums.py index 9e6df12..6a9a58e 100644 --- a/sublime/ui/albums.py +++ b/sublime/ui/albums.py @@ -23,7 +23,7 @@ def _to_type(query_type: AlbumSearchQuery.Type) -> str: AlbumSearchQuery.Type.STARRED: "starred", AlbumSearchQuery.Type.ALPHABETICAL_BY_NAME: "alphabetical", AlbumSearchQuery.Type.ALPHABETICAL_BY_ARTIST: "alphabetical", - AlbumSearchQuery.Type.YEAR_RANGE: "year", + AlbumSearchQuery.Type.YEAR_RANGE: "year_range", AlbumSearchQuery.Type.GENRE: "genre", }[query_type] diff --git a/tests/adapter_tests/filesystem_adapter_tests.py b/tests/adapter_tests/filesystem_adapter_tests.py index e226d86..cbb73b0 100644 --- a/tests/adapter_tests/filesystem_adapter_tests.py +++ b/tests/adapter_tests/filesystem_adapter_tests.py @@ -893,7 +893,7 @@ def test_search(cache_adapter: FilesystemAdapter): with pytest.raises(CacheMissError): cache_adapter.get_song_details("s1") - search_result = SublimeAPI.SearchResult() + search_result = SublimeAPI.SearchResult("") search_result.add_results( "albums", [