Req Return Array of All Artists for a Given Song
#1
In ArtistSlideshow when I call xbmc.Player().getMusicInfoTag().getArtist() I get a string that may actually contain multiple artists. I'm parsing them on my end, but I wish I didn't have to try and keep up with all the ways the music scrapers split multiple artists. It would be great if for the next XBMC version (or earlier, I'd be totally OK with earlier) there was another call like xbmc.Player().getMusicInfoTag().getArtists() that would return an array of artists for a given song. Then I could just use that instead and quit trying to keep up with the scrapers manually.

Or is something like that already available and I just missed it?

Thanks.
Reply
#2
i'm not 100% sure if the same info can be retrieved through json-rpc,
but there a chance it will return the artists as an array.

it at least does so when i query the library through json-rpc.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
I'll look into that. If I use json within a plugin, does the user have to have the json stuff enabled? I'm also wondering what kind of performance hit I'd be looking at (and load on XBMC) given that this call is done every half a second (or more).
Reply
#4
xbmc.executejson() is always active. JSON-RPC is quite fast.
Reply
#5
(2013-02-21, 06:20)pkscuot Wrote: I'll look into that. If I use json within a plugin, does the user have to have the json stuff enabled?

nope, that's not needed.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#6
It took me a little bit to get the JSON call right, but once that was done it works fine. In case anyone is curious:
Code:
if( xbmc.Player().isPlayingAudio() == True ):
   response = xbmc.executeJSONRPC ( '{"jsonrpc":"2.0", "method":"Player.GetItem", "params":{"playerid":0, "properties":["artist","musicbrainzartistid"]},"id":1}' )
    artists = json.loads(response)['result']['item']['artist']

And it looks like when the MusicBrainzID is populated I can get it as well (you'll notice I'm already asking for it, but on my system it's empty for every artist).

One last question (hopefully). There is logic at the beginning to check and see if the player is playing an audio file. Given that, is it safe to assume that the playerid will always be 0, or do I need to get the list of players and find the one that's playing audio?
Reply

Logout Mark Read Team Forum Stats Members Help
Return Array of All Artists for a Given Song0