Fixed some issues with search
This commit is contained in:
@@ -58,3 +58,4 @@ addopts =
|
||||
--cov=sublime
|
||||
--cov-report html
|
||||
--cov-report term
|
||||
--no-cov-on-fail
|
||||
|
@@ -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()
|
||||
),
|
||||
)
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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]
|
||||
|
||||
|
@@ -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",
|
||||
[
|
||||
|
Reference in New Issue
Block a user