nagyrobi / home-assistant-custom-components-linkplay

LinkPlay based media devices integration for Home Assistant.
170 stars 32 forks source link

Parse radio track titles #11

Closed Limych closed 4 years ago

Limych commented 4 years ago

Thank you for tweaking and improving this component. I will then remove my component version from HACS as obsolete so that users do not confuse it with yours.

When using your component, track titles appeared when radio listening. But these track titles look a little odd. Here are some sample strings:

ELODIE~Guaranà~~~~~2020-08-13T08:11:53.252527~2020-08-13T08:11:53.252527~United Music Subasio +
GAIA~Chega~~~~~2020-08-13T08:15:04.497720~2020-08-13T08:15:04.497720~United Music Subasio +
LP~The One That You Love~~~~~2020-08-13T08:17:59.475604~2020-08-13T08:17:59.475604~United Music Subasio +

Note: Each string contains a line feed character at the end.

Please make an improvement so that such variants of track titles are automatically recognized and rendered in a human-friendly form.

nagyrobi commented 4 years ago

From where do you get this kind of strings? What service?

Limych commented 4 years ago

I, unfortunately, do not know what program is creating this stream. This is one of the webradios from here:

https://radiosubasio.it/player/#!/channel/1

nagyrobi commented 4 years ago

And how do you put streams from this webpage to your Linkplay device? Through HA? I don't see any Icecast-compatible sreams on that webpage, they have hidden the stream...

Limych commented 4 years ago

Yes, the stream address is hidden there. I don't remember exactly where and how I got it there. Here is the address:

https://icy.unitedradio.it/SubasioPiu.mp3

I send it from HA to the speaker. Then it itself pulls the stream directly.

Now I'm watching the names of the tracks. Usually the picture goes like this:

media_title: LUCIANO LIGABUE~Piccola Stella Senza Cielo~~~~~2020-08-13T18:18:13.699985~2020-08-13T18:18:13.699985~United Music Subasio +
media_artist: []

But once I saw this version:

media_title: Giorni Migliori~~~~~2020-08-13T18:15:54.106793~2020-08-13T18:15:54.106793~United Music Subasio +
media_artist: ONE REPUBLIC & NEGRAMARO~Better Days
nagyrobi commented 4 years ago

This doesn't look like standard icecast stream metadata.

Limych commented 4 years ago

Even so ... This format was not invented by me, and judging by the fact that that radio station clearly uses some kind of standard solution, there is a high chance of meeting this format in other streams as well.

It is possible to recognize this format without breaking the recognition of the standard format. The required code is already in the PR.