Issue caused by newline character in the description of a channel in a source playlist

I noticed a problem after installing Pluto TV France that was kindly generated by @joagomez :slight_smile:

My script that checks for channel lineup changes started reporting changes from a specific channel at every scan (every 30 minutes):

Pluto TV France: 129 channels (=)
(http://127.0.0.1:7777/pluto/fr/playlist.m3u)

<--- Lineup changes (starting at 32845) --->
! 32949 : tvg-id="6228b86dbb834e0007b75019" tvg-chno="1195" group-title="Kids" tvg-logo="https://images.pluto.tv/channels/6228b86dbb834e0007b75019/colorLogoPNG.png" tvc-guide-title="Pluto TV Kids Ukraine" tvc-guide-description="Cette chaîne est dédiée à tous les enfants ukrainiens qui se trouvent actuellement en France. (was tvg-id)

<--- Channel changes --->
- tvg-id (32949)
+ tvg-id="6228b86dbb834e0007b75019" tvg-chno="1195" group-title="Kids" tvg-logo="https://images.pluto.tv/channels/6228b86dbb834e0007b75019/colorLogoPNG.png" tvc-guide-title="Pluto TV Kids Ukraine" tvc-guide-description="Cette chaîne est dédiée à tous les enfants ukrainiens qui se trouvent actuellement en France. (32949)

As you can see, the channel name is completely wrong.

My first thought, of course, was that there was a bug in my script.

So I started looking at my code, especially the part that retrieves the channel information. This is done by reading from 'http://dvr-ip:8089/devices` so I viewed the output in the browser and looked for this channels number (32949) and there is something off right there in the json output:

            {
                "ID": "pluto-pluto-tv-kids-ukraine-fr",
                "GuideNumber": "32949",
                "GuideName": "tvg-id=\"6228b86dbb834e0007b75019\" tvg-chno=\"1195\" group-title=\"Kids\" tvg-logo=\"https://images.pluto.tv/channels/6228b86dbb834e0007b75019/colorLogoPNG.png\" tvc-guide-title=\"Pluto TV Kids Ukraine\" tvc-guide-description=\"Cette chaîne est dédiée à tous les enfants ukrainiens qui se trouvent actuellement en France.",
                "HD": 1,
                "Station": "pluto-pluto-tv-kids-ukraine-fr"
            },
            {
                "ID": "pluto-gaming-tv-fr",
                "GuideNumber": "32950",
                "GuideName": "Gaming TV",
                "HD": 1,
                "Station": "5f8eccd81062c300078a11df",
                "Logo": "https://images.pluto.tv/channels/5f8eccd81062c300078a11df/colorLogoPNG.png",
                "Categories": [
                    "Divertissement"
                ],
                "Title": "Gaming TV",
                "Description": "La chaîne pour les gamers et tout ce que les gamers adorent ! Gaming TV sélectionne pour vous les dernières et les meilleures infos du monde du jeu. Avis, actualités, interviews, reportages, rétrospectives, livestreams et plus encore !"
            },

The field GuideName is incorrect, and other fields are missing.

So the next step was to check the playlist itself for Pluto TV France and this what it looks like:

#EXTINF:-1 channel-id="pluto-pluto-tv-kids-ukraine-fr" tvg-id="6228b86dbb834e0007b75019" tvg-chno="1195" group-title="Kids" tvg-logo="https://images.pluto.tv/channels/6228b86dbb834e0007b75019/colorLogoPNG.png" tvc-guide-title="Pluto TV Kids Ukraine" tvc-guide-description="Cette chaîne est dédiée à tous les enfants ukrainiens qui se trouvent actuellement en France.
Цей канал присвячений саме всім українським дітям, які зараз перебувають у Франції.",Pluto TV Kids Ukraine
http://127.0.0.1:7777/pluto/fr/watch/6228b86dbb834e0007b75019

Everything seems to be in the right place.
I'm guessing that the fact that there are Cyrillic characters is probably the root cause of the problem.

This is what the TV guide looks like on the web UI:

I'm still able to click on a program and watch it:

After listening to it for a minute, I can confirm that it is in Ukrainian, definitely not in French. :laughing:

@joagomez I'm guessing you have no control over the contents of the playlist, do you? Because one way to get rid of this problem would be to remove the Cyrillic characters in the playlist itself.

However, this still shows that there seems to be a problem with the way Channels processes that alphabet as seen in the json output.
@tmm1 maybe?

Please advise.

Looks like the tvc-guide-description has two lines (a line feed inserted?)
First line is the description in French
Second line is the description in Ukranian
"This channel is dedicated to all Ukrainian children currently in France."
Translation courtesy of DeepL Translate: The world's most accurate translator

If it's a newline character, maybe Aman can fix it. He just did for XMLTV data here Syntax Error Workarounds Instead of Failing

1 Like

newlines not allowed in m3u files

1 Like

Ah OK, thank you for clarifying this.

I will change the title of this thread.

So it's the playlist that needs to be fixed.
@joagomez do you think it's possible to fix it?

1 Like

Did you bring the playlist up in a text editor that can show control characters (like Notepad++) to see if there's a linefeed or carriage return within the tvc-guide-description?

I did use Notepad++ to view the playlist but I didn't pay attention to control characters.

As soon as I saw the Cyrillic characters, I immediately jumped to the conclusion that this was the cause.
How simple minded I am. :laughing:

In the meantime, I'm thinking about what I can do in my script to ignore this issue so that I can run my script again.

In Notepad++ you can view all characters
View > Show Symbol > Show All Characters

1 Like

Thank you.

Indeed, there is a LF character in the description:

So the M3U is malformed.
I thought Channels could detect if an M3U was malformed and report it, no?

1 Like

I’ll see if I can strip line feeds and carriage returns since I have to assume that is coming from the api

3 Likes

Updated code to remove control characters from station API summary string leaving other Unicode characters for tvc-guide-description in playlist

I can look to adding this to other strings pulled by the API that build out the m3u playlist, but just added to tvc-guide-description for now

1 Like

Thank you very much! I will update as soon as I get the chance and will report back.

Great job, @joagomez ! Issue fixed! :partying_face:

Pluto TV France: 133 channels (=)
(http://127.0.0.1:7777/pluto/fr/playlist.m3u)


<--- Lineup changes (starting at 32845) --->
! 32949 : Pluto TV Kids Ukraine (was tvg-id)

<--- Channel changes --->
+ Pluto TV Kids Ukraine (32949)
- tvg-id (32949)

:+1: