Kodi Community Forum

Full Version: small bug in search when returned item is a compliation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I stumbled upon this by accident. When use kodi's search function (script.globalsearch) and you search for a music artist and want to open an album from the search and this album is a compilation you get returned to the search screen and you are asked if you want to do another search, you do not get to the album/compilation.

To reproduce:
Open kodi's search, enter an artist that is included in a compilation
open the artist in the search result
try to open a compilation album
For comparison open a "normal" album

https://pastebin.com/M7dnpS7k (relevant lines start at 1860 I think)
For comparison a "normal" album: https://pastebin.com/mNrJ1KzQ
Yes, confirmed. The search ends with No results found even though the album was just displayed.

Not sure if this is one for @ronie or @DaveBlake
it might be a problem in globalsearch indeed.
since i don't have any compilations in my collection, i can't easily test myself if this fixes it:
script.globalsearch-8.0.9.zip

please let me know :-)
Hi @ronie I tested your fix.

You no longer receive the No Results Found message, but you do get every song in the album returned.

eg,
1. Search Local Library for Alphaville
2. The Alphaville Artist is found.
3. Click the Artist for the songs
4. Compliation Album(s) are displayed
5. Click the album and every song in the Compilation is displayed. But our starting point was searching for a single artist and, one would assume, their songs.
Tested the fix too and can confirm Karellen's findings. It is an improvement but indeed expected behaviour from a search function imo would be that the songs from this artist in the compilations get displayed and not the songs by other artists too.

I just checked, because I wasn't sure. When you open a compilation album through the artist node in the music library you only get the songs of that particular artist on the compilation. So this view would be the expected behaviour I would guess.
@DaveBlake is it possible with json to retrieve songs matching both artistid and albumid ?

this doesn't work:
json:
{"jsonrpc":"2.0", "method":"AudioLibrary.GetSongs", "params":{"properties":["title", "artist", "album"], "filter":{"artistid":3, "albumid":8}}, "id": 1}

filtering by either one of those works fine, but i can't figure out how to use both...
In short no @ronie
The API was designed so that only one of the id filters can be applied per request e.g. "artistid" or "albumid" but not both. There are situations where this is a tedious limitation, for example wanting an artist and genre combination (if the artist is a crossover or you have used genres as personalised categorisation), but since an album has specififc artists I'm not sure why you want "artistid" and "albumid"?

EDIT: ah OK I read back, you want to emulate the normal artist > album > songs navigation in search results. This should be achievable by building the correct virtual path
e.g musicdb://artists/3415/1171/?albumartistsonly=false&artistid=3415
EDIT2 But looking at the script I see that isn't a very helpful comment, you want to get "the songs on this album with this song artist" using JSON. I can see two possible approaches with the current id filter limitations (something I would love to change BTW but is fundamental to the current API schema)
1) Request all the songs on the album, then filter in the script for the artistid before showing them
2) Use a field type of filter for the artist name rather than the ID e.g.
"filter": {"field": "artist", "operator": "is", "value": "ABBA"}

I have not tried 2), and I think it may not work combined with a param type filter "albumid".
thanx for the detailed info, much appreciated!
it's indeed the exact thing i was trying to accomplish.

i guess option 1 would be the best way forward.. i'll consider it.
(i'm not really keen on implementing all kinds of workarounds for specific searches in the addon)
(2019-01-15, 03:41)ronie Wrote: [ -> ]i guess option 1 would be the best way forward.. i'll consider it.
(i'm not really keen on implementing all kinds of workarounds for specific searches in the addon)
I understand that, the API simply needs to be less restrictive.
My other thought would be could the addon take the user to the music library screen for the lower results rather than use its own display, then you could use the virtual path approach. But of course that may not be viable, I don't know how the addon side works.

In the end seeing all the songs on a compilation is not a big disaster really, just inconsistent with normal navigation and a motivation to improve the API
I agree. No idea how long that bug has been around, I just stumbled upon it totally by accident. The fix from Ronie is an improvement. Getting all songs of a compilation through the search function is not so bad.