su1s / e2m3u2bouquet

Enigma2 IPTV m3u parser and bouquet creator
GNU General Public License v3.0
68 stars 50 forks source link

Bad stream names when stream names also include commas #97

Closed oottppxx closed 5 years ago

oottppxx commented 5 years ago

My proposed patch:

`@@ -898,9 +898,9 @@ service_dict[channel[i].lower().strip(' =')] = channel[i + 1].decode('utf-8')

\ # Get the stream name from end of line (after comma) - stream_name_pos = line.rfind(',') + stream_name_pos = line.rfind('",') if stream_name_pos != -1: - service_dict['stream-name'] = line[stream_name_pos + 1:].strip().decode('utf-8') + service_dict['stream-name'] = line[stream_name_pos + 2:].strip().decode('utf-8')

\ # Set default name for any blank groups if service_dict['group-title'] == '': `

Of course this just trades the assumption that there are no commas on stream names for the assumption that the stream name separation from the previous field assignment will have no spaces... And that stream names don't include quotes followed by commas.

DougMac commented 5 years ago

Thanks @oottppxx. I'll hopefully get a chance to look at this and other issues over the next few days

DougMac commented 5 years ago

Actually I think this may already be fixed in the long overdue upcoming release.

Instead of having the service name in both the the service and description line it will only be in the description line. i.e.

SERVICE 1:0:1:8c78:756f:8a2e:0:0:0:0:http%3A//test.xyz/101.ts:BBC One HD (UK, Main)

DESCRIPTION BBC One HD (UK, Main)

will become

SERVICE 1:0:1:8c78:756f:8a2e:0:0:0:0:http%3A//test.xyz/101.ts:

DESCRIPTION BBC One HD (UK, Main)

I think this will this resolve which I also believe only affects some boxes.

oottppxx commented 5 years ago

The issue is not about how the stream name is emitted but about how it's parsed from the M3U.

E.g., if you have an M3U line with comma(s) in the strem name:

... group-title="xxx",stream name before, stream name after

You end up with stream name being "stream name after" instead of "stream name before, stream name after"

If it's already fixed in a newer unpublished version, great, but if not, your example would end up just displaying " Main)" as the stream name in the current version.

DougMac commented 5 years ago

Ok, thanks. Looks like a different issue. Will put your fix in place for v0.8.3

DougMac commented 5 years ago

Included in v0.8.3