# Parsing info from Kodi

**URL:** <https://discourse.nodered.org/t/parsing-info-from-kodi/20211>\
**Category:** Dashboard\
**Created:** [12 January 2020 05:49 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211 "2020-01-12T05:49:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![konrul](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@konrul](https://discourse.nodered.org/u/konrul)\
**Post date:** [12 January 2020 05:49 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/1 "2020-01-12T05:49:27Z")

</div>

Hello everyone,

I am new on Node-red, and I have another problem. While music (i.e., from youtube) is playing on Kodi, I want to see the music title, artist, year, etc.

However, I see the information like this:

{"notification":"Player.OnAVStart","data":{"data":{"item":{"title":"World's Most Epic Music Ever: Pressed For Time (Amine Sebti)","type":"video","year":2016},"player":{"playerid":1,"speed":1}},"sender":"xbmc"}}

But they are not tidy. I would prefer to see the only title like "World's Most Epic Music Ever: Pressed For Time (Amine Sebti)"

I also use "node-red-contrib-kodi" and here is my flow:

```auto
[{"id":"3b137f22.17037","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"a91c535c.6f2df","type":"kodi-in","z":"3b137f22.17037","name":"kodi","controller":"d202ce84.24c45","x":263,"y":368,"wires":[["a8d5e129.5438b","95b72b4c.488658"]]},{"id":"95b72b4c.488658","type":"debug","z":"3b137f22.17037","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":622,"y":312,"wires":[]},{"id":"a8d5e129.5438b","type":"ui_text","z":"3b137f22.17037","group":"2f101410.857cfc","order":12,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":598.482666015625,"y":416.32275390625,"wires":[]},{"id":"d202ce84.24c45","type":"kodi-controller","z":"","name":"kodi","host":"localhost","port":"9090"},{"id":"2f101410.857cfc","type":"ui_group","z":"","name":"Kodi Kontrol","tab":"743f23a2.ece61c","order":5,"disp":true,"width":"6","collapse":true},{"id":"743f23a2.ece61c","type":"ui_tab","z":"","name":"R10 Dome","icon":"home","order":2,"disabled":false,"hidden":false}]

```

I have already checked "Node-Red Working with messages" and " Understanding and Using The Node-Red Message Object" but I still don't understand. Can anyone give me at least one working example?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 January 2020 07:16 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/2 "2020-01-12T07:16:24Z")

</div>

I don't have the kodi node so i cannot import, but it is not really relevant.

Example flow:

```auto
[{"id":"6dba6cb0.40430c","type":"inject","z":"21514fd8.04e2a8","name":"","topic":"","payload":"{\"notification\":\"Player.OnAVStart\",\"data\":{\"data\":{\"item\":{\"title\":\"World's Most Epic Music Ever: Pressed For Time (Amine Sebti)\",\"type\":\"video\",\"year\":2016},\"player\":{\"playerid\":1,\"speed\":1}},\"sender\":\"xbmc\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":206,"y":216,"wires":[["ca1c0b9a.9ae0e8","6719054e.61334c"]]},{"id":"6719054e.61334c","type":"debug","z":"21514fd8.04e2a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":622,"y":216,"wires":[]},{"id":"ca1c0b9a.9ae0e8","type":"change","z":"21514fd8.04e2a8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data.data.item.title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":392,"y":288,"wires":[["6719054e.61334c"]]}]

```

Check the change node to get a hint how to get the title.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 January 2020 08:34 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/3 "2020-01-12T08:34:36Z")

</div>

See also [https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

---

<div class="post-metadata">

**Author:** ![konrul](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@konrul](https://discourse.nodered.org/u/konrul)\
**Post date:** [12 January 2020 13:56 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/4 "2020-01-12T13:56:08Z")

</div>

Hello, thank you for your answers,

bakman2 I will check it; thank you, dceejay, I have already read that link, but I still can't handle; therefore, I have written here to ask any example. Thanks for your contribution.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 January 2020 14:14 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/5 "2020-01-12T14:14:12Z")

</div>

For example, to pick up the title from your example configure a Change node to Move msg.payload.data.data.item.title To msg.payload.  
At least I think that is the right path to move from, but as explained in the link you can get the debug window to copy that to the clipboard by clicking the little icon above it and then paste it into the Change node.

---

<div class="post-metadata">

**Author:** ![konrul](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@konrul](https://discourse.nodered.org/u/konrul)\
**Post date:** [12 January 2020 21:47 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/6 "2020-01-12T21:47:04Z")

</div>

Hello everyone,

First of all, I want to thank you for your interest. Now I understood the method so that I can try other attributes. Thank you very much!

Colin, I wasn't at home, so I will also try your advice, and I think the Change node will enable more than one attribute. (Edit: Sorry [bakman2](https://discourse.nodered.org/u/bakman2) also pointed for the change node. I need to add a node for each attribute I think)

Best regards!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 January 2020 22:02 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/7 "2020-01-12T22:02:34Z")

</div>

> [@konrul](#):
>
> I need to add a node for each attribute I think

Possibly, it depends on what you want to do with the data. Many nodes have the ability to extract a value from an attribute rather than requiring the value directly in the payload. For example if you wanted to display the title from your object in a text node on the dashboard you could feed the whole structure to the text node and configure it to show the value in msg.payload.data.data.item.title, so no Change node required.

---

<div class="post-metadata">

**Author:** ![konrul](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@konrul](https://discourse.nodered.org/u/konrul)\
**Post date:** [12 January 2020 22:17 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/8 "2020-01-12T22:17:49Z")

</div>

Hello Colin,

> [@Colin](#):
>
> if you wanted to display the title from your object in a text node on the dashboard you could feed the whole structure to the text node and configure it to show the value in msg.payload.data.data.item.title, so no Change node required.

Great idea! I will try this. As I am a newbie in Node-Red, I have a long way to think from different angles. Thank you very much for your advice and ideas!

By the way, should I share my flow as an example? If you let me do this, I will also credit you, people. Maybe we can discuss this idea on another topic or here. You have a significant impact and effort on this work. Thank you again!

---

<div class="post-metadata">

**Author:** ![konrul](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@konrul](https://discourse.nodered.org/u/konrul)\
**Post date:** [13 January 2020 00:21 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/9 "2020-01-13T00:21:37Z")

</div>

Hello again,

I am not sure if this message is appropriate to send after my last entry, but I wanted to add another issue.

The advice worked well, thank you, however, when I change the volume, the title becomes untidy and turn into a volume-related object. How can I keep the title even I change the volume? If I use to play/stop button, the volume related info disappears, and the title can be seen well. Nevertheless, this method, obviously, inconvenient.

I am open to hearing your advice and ideas again 🙂

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 January 2020 07:24 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/10 "2020-01-13T07:24:00Z")

</div>

I suggest you start a new thread with this issue as it is not at all related to the thread title. You need to make the question clearer as personally I have no idea what you mean. Possibly a screenshot to show the issue.

---

<div class="post-metadata">

**Author:** ![konrul](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@konrul](https://discourse.nodered.org/u/konrul)\
**Post date:** [13 January 2020 17:13 UTC](https://discourse.nodered.org/t/parsing-info-from-kodi/20211/11 "2020-01-13T17:13:04Z")

</div>

Hello Colin, I have started a new thread with this issue in this link

[Click Here](https://discourse.nodered.org/t/title-info-is-changing-when-other-action-is-made/20271)

Thank you for your interest!
