Fixed some issues with search
This commit is contained in:
@@ -58,3 +58,4 @@ addopts =
|
|||||||
--cov=sublime
|
--cov=sublime
|
||||||
--cov-report html
|
--cov-report html
|
||||||
--cov-report term
|
--cov-report term
|
||||||
|
--no-cov-on-fail
|
||||||
|
@@ -968,7 +968,7 @@ class AdapterManager:
|
|||||||
return sorted(
|
return sorted(
|
||||||
it,
|
it,
|
||||||
key=lambda x: AdapterManager._strip_ignored_articles(
|
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:
|
def search(self, query: str) -> API.SearchResult:
|
||||||
result = self._get_json(self._make_url("search3"), query=query).search_result
|
result = self._get_json(self._make_url("search3"), query=query).search_result
|
||||||
if not 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("albums", result.album)
|
||||||
search_result.add_results("artists", result.artist)
|
search_result.add_results("artists", result.artist)
|
||||||
search_result.add_results("songs", result.song)
|
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.STARRED: "starred",
|
||||||
AlbumSearchQuery.Type.ALPHABETICAL_BY_NAME: "alphabetical",
|
AlbumSearchQuery.Type.ALPHABETICAL_BY_NAME: "alphabetical",
|
||||||
AlbumSearchQuery.Type.ALPHABETICAL_BY_ARTIST: "alphabetical",
|
AlbumSearchQuery.Type.ALPHABETICAL_BY_ARTIST: "alphabetical",
|
||||||
AlbumSearchQuery.Type.YEAR_RANGE: "year",
|
AlbumSearchQuery.Type.YEAR_RANGE: "year_range",
|
||||||
AlbumSearchQuery.Type.GENRE: "genre",
|
AlbumSearchQuery.Type.GENRE: "genre",
|
||||||
}[query_type]
|
}[query_type]
|
||||||
|
|
||||||
|
@@ -893,7 +893,7 @@ def test_search(cache_adapter: FilesystemAdapter):
|
|||||||
with pytest.raises(CacheMissError):
|
with pytest.raises(CacheMissError):
|
||||||
cache_adapter.get_song_details("s1")
|
cache_adapter.get_song_details("s1")
|
||||||
|
|
||||||
search_result = SublimeAPI.SearchResult()
|
search_result = SublimeAPI.SearchResult("")
|
||||||
search_result.add_results(
|
search_result.add_results(
|
||||||
"albums",
|
"albums",
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user