How to retrieve current (Kodi) music stream url?

I would like to display the name of the current Radio station playing.

My dashboard already shows the current artist and title playing, Can I display the radio station name as well? (and eventually show ‘local file’ when it’s not a stream, but that’s the next step)

For now I’m curious how to retrieve the playing Kodi stream url is it some JSON call maybe? I hope somebody created something alike already and can help me a bit further.

Here is the kodi api. I have used it in the past for some other work.
https://kodi.wiki/view/JSON-RPC_API

Thank you for a fast response. Since you wrote you’ve done some other work with the Kodi API in the past maybe you be willing to point me in the right direction what to search for? I haven’t used the Kodi api ever before and only recently started fine-tuning my dashboard.

service: kodi.call_method
data:
  entity_id: media_player.androd

Starting with something like the above I reckon? (media_player.android is my Kodi entity)

I honestly don’t have the time to investigate at the moment, for what it is worth here is my other code for reference. If you solve your problem be sure and update the community.

Thanks

Louis van Gaal would say something like: “That goes above my hat.” :wink:
Meaning I have no knowledge and no expertise on the subject, hence my question here in this community.
Fore sure I will keep this thread alive with my findings and will post every update.

So far I’ve found that method: Player.GetItem should give the current track information. Can anybody help me further on how to implement this in some sort of template I guess?

you can use those param with the method:

service: kodi.call_method
data:
  method: Player.GetItem
  playerid: 1
  properties: 
    - title
    - artist
    - albumartist
    - genre
    - year
    - rating
    - album
    - track
    - duration
    - comment
    - lyrics
    - musicbrainztrackid
    - musicbrainzartistid
    - musicbrainzalbumid
    - musicbrainzalbumartistid
    - playcount
    - fanart
    - director
    - trailer
    - tagline
    - plot
    - plotoutline
    - originaltitle
    - lastplayed
    - writer
    - studio
    - mpaa
    - cast
    - country
    - imdbnumber
    - premiered
    - productioncode
    - runtime
    - set
    - showlink
    - streamdetails
    - top250
    - votes
    - firstaired
    - season
    - episode
    - showtitle
    - thumbnail
    - file
    - resume
    - artistid
    - albumid
    - tvshowid
    - setid
    - watchedepisodes
    - disc
    - tag
    - art
    - genreid
    - displayartist
    - albumartistid
    - description
    - theme
    - mood
    - style
    - albumlabel
    - sorttitle
    - episodeguide
    - uniqueid
    - dateadded
    - channel
    - channeltype
    - hidden
    - locked
    - channelnumber
    - subchannelnumber
    - starttime
    - endtime
    - specialsortseason
    - specialsortepisode
    - compilation
    - releasetype
    - albumreleasetype
    - contributors
    - displaycomposer
    - displayconductor
    - displayorchestra
    - displaylyricist
    - userrating
    - sortartist
    - musicbrainzreleasegroupid
    - mediapath
    - dynpath
    - isboxset
    - totaldiscs
    - disctitle
    - releasedate
    - originaldate
    - bpm
    - bitrate
    - samplerate
    - channels
    - albumstatus
    - datemodified
    - datenew
    - customproperties
    - albumduration
target:
  entity_id: media_player.kodi

for me i found more useful following method to retrive ongoing stream name(s):

service: kodi.call_method
data:
  method: XBMC.GetInfoLabels
  labels: 
    - MusicPlayer.Title
    - MusicPlayer.Artist
target:
  entity_id: media_player.kodi