mitchray / ample

A simple web browser client for Ampache
https://ample-player.vercel.app/
GNU Affero General Public License v3.0
61 stars 13 forks source link

The "All" tab of the "Album Artists" view lists also artists without albums #51

Closed paulijar closed 1 year ago

paulijar commented 1 year ago

The "All" tab of the "Album Artists" view is not limited to album artists only, it shows all the artists known by the server. The default "Random" tab of the same view is correctly limited to showing only artists having own albums.

The contents for the default "Random" tab of the "Album Artists" view are fetched with a query like https://develop.ampache.dev/server/json.server.php?action=advanced_search&type=artist&operator=and&random=1&offset=0&limit=50&rule_1=album_count&rule_1_operator=4&rule_1_input=0&auth=a89f9acd88061901f21c8f8a7d48d7b9&version=6.0.0. Here, artists without own albums are filtered out by requiring that the album_count > 0.

Meanwhile, the list of artist names shown on the left apparently comes from this query https://develop.ampache.dev/server/json.server.php?action=advanced_search&type=artist&offset=0&limit=0&operator=and&rule_1=title&rule_1_operator=5&rule_1_input=&auth=a89f9acd88061901f21c8f8a7d48d7b9&version=6.0.0. This query fetches all the artists but apparently the result is later filtered based on the albumcount property in the result objects.

But then, when the "All" tab is activated, there is another query like https://develop.ampache.dev/server/json.server.php?action=advanced_search&type=artist&operator=and&limit=0&rule_1=title&rule_1_operator=8&rule_1_input=%5E&auth=a89f9acd88061901f21c8f8a7d48d7b9&version=6.0.0 This again fetches all the artists (filtered with an empty regex) but this time, there doesn't seem to be any filtering on the front-end, either.

Note that there would be many alternatives to fetch the album artists from the server. One is to use the artists API method and pass the parameter album_artist=1. Or if you really want to use the advanced_search, then it's possible to pass it the parameter type=album_artist instead of type=artist.

It might also be a good idea to avoid the regex searches when not strictly necessary, as they may have poor performance on large databases.

mitchray commented 1 year ago

Fixed in 2.0.2, thanks