hoshsadiq / m3ufilter

ABANDONED - A tool that allows to filter specific items from an m3u filter designed for IPTV.
GNU General Public License v2.0
49 stars 18 forks source link

Quotes in tvg-name break parsing #6

Closed alexzeitgeist closed 5 years ago

alexzeitgeist commented 5 years ago

If an item contains a tvg-name attribute with a value containing quotes, the parsing would break:

#EXTINF:-1 tvg-id="" tvg-name="This is "a test"" tvg-logo="http://localhost/logo.jpg" group-title="TEST",This is "a test"

results in the error

time="2019-09-09T14:36:30+02:00" level=error msg="could not retrieve playlist from provider file:////playlist_1.m3u, err = Unexpected character '\"' found, expected '=' for key test on position 46 in line: #EXTINF:-1 tvg-id=\"\" tvg-name=\"This is \"a test\"\" tvg-logo=\"http://localhost/logo.jpg\" group-title=\"TEST\",This is \"a test\"

hoshsadiq commented 5 years ago

This is unfortunately hard to mitigate. The quotes will need to be escaped. It already handles escaped quotes but I'm not sure how else it would handle such a case.

Is the source m3u file generated by the m3ufilter or did it come from elsewhere?

alexzeitgeist commented 5 years ago

Hi, this is from an external playlist, which makes m3ufilter stumble in the processing loop.

Shouldn't escaping the quotes in the source make it work? Even if it quoted, as in \"a test\", m3ufilter would still break.

If this is difficult to mitigate, how about an option to skip over entries, where parsing failed, rather than exiting the whole process?

hoshsadiq commented 5 years ago

The issue is that if the quotes are not escaped properly it's hard to figure out where the tvg-name starts, and where it ends. The best that can be done is guess where it starts/ends but that will for sure introduce other more critical issues so I'm not particularly willing to compromise on that. Your best bet is to contact the provider and ask them to fix it, which in my opinion is the proper solution.

Having said that, adding an option to ignore badly formed channels is a good idea nonetheless. I will work on adding this.

hoshsadiq commented 5 years ago

This has now been added, will make a release later in the week.