edit4ever / script.module.zap2epg

zap2epg - EPG grabber for USA/Canada
GNU General Public License v3.0
41 stars 25 forks source link

Malformed xml syntax due to bad Zap2IT data #44

Open Kensit opened 2 years ago

Kensit commented 2 years ago

First off, I am not positive this is something you need to address but I will explain what is happening and you can decide if it should be.

Recently, Zap2IT pushed some bad data in a episode of a program in which the text description contained characters that made the xml bad syntactically. Specifically the following string was inserted as an episode title "wvrdr_error_100". This string was inserted into the xml file and resulted in the EPG ignoring all xml following where the syntax problem appeared date-wise.

Now, clearly this was Zap2IT's fault and likely a one-off (it only occurred in a single episode of a TV series, DC's Legends of Tomorrow. However, the bigger issue is, should zap2epg make sure that all data written to the xmltv file is syntactically good?

jbreen60030 commented 2 years ago

I tripped over this one last week when it blew out my guide in Plex. If you're using the current version, it appears that adding the stitle=true in the settings.xml should resolve the issue (as it makes safe titles). see release 2.0.3 (https://github.com/edit4ever/script.module.zap2epg/releases)

I modified my copy to HTML escape the title and descriptions (basically what the new 2.0.3 functionality added), but it was an older version that I had also added other functionality. It did rectify the issue.

Kensit commented 2 years ago

I tripped over this one last week when it blew out my guide in Plex. If you're using the current version, it appears that adding the stitle=true in the settings.xml should resolve the issue (as it makes safe titles). see release 2.0.3 (https://github.com/edit4ever/script.module.zap2epg/releases)

I modified my copy to HTML escape the title and descriptions (basically what the new 2.0.3 functionality added), but it was an older version that I had also added other functionality. It did rectify the issue.

I too have modified my own copy (for this and adding my own genre handling for colouring the guide). However, I escape ALL text values written to the xmltv file. Note that the stitle option only applies to the title and not the description (which the title also is added to when the extended description option is chosen). Also, the stitle option produced gibberish in the show descriptions, so I turned it off. It seems to me to be a slapdash workaround for not doing the 'write' (sic) thing in the first place and escape all text strings.

jbreen60030 commented 2 years ago

I don't use Kodi, I use this for feeding an xmltv to Plex. I also optimized the code and also escaped any place where the code had originally converted "&". I had not tried it.

On Fri, Oct 22, 2021 at 3:37 PM Lorne Nicol @.***> wrote:

I tripped over this one last week when it blew out my guide in Plex. If you're using the current version, it appears that adding the stitle=true in the settings.xml should resolve the issue (as it makes safe titles). see release 2.0.3 (https://github.com/edit4ever/script.module.zap2epg/releases )

I modified my copy to HTML escape the title and descriptions (basically what the new 2.0.3 functionality added), but it was an older version that I had also added other functionality. It did rectify the issue.

I too have modified my own copy (for this and adding my own genre handling for colouring the guide). However, I escape ALL text values written to the xmltv file. Note that the stitle option only applies to the title and not the description (which the title also is added to when the extended description option is chosen). Also, the stitle option produced gibberish in the show descriptions, so I turned it off. It seems to me to be a slapdash workaround for not doing the 'write' (sic) thing in the first place and escape all text strings.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edit4ever/script.module.zap2epg/issues/44#issuecomment-949945440, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEYSPJEX6ZT7VU2C7N5Z2LUIHDRFANCNFSM5GKAH6XA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Rippert commented 2 years ago

Hi, I'm using an older, python 2, version of Zap2EPG and seeing the same problem. Is there an easy way to escape all text values written to the XML file?

I see this in the code for the title escape safeTitle = re.sub('[\\/*?:"<>|]', "_", showTitle)

Hoping to avoid trying to find all instances of variables written to the XML file and adding this kind of line to them, if possible, and really hoping not to have to upgrade everything to Kodi 19 to get the python 3 version as that requires a full OS upgrade on my system.

Thanks

Kensit commented 2 years ago

Hi, I'm using an older, python 2, version of Zap2EPG and seeing the same problem. Is there an easy way to escape all text values written to the XML file?

I see this in the code for the title escape safeTitle = re.sub('[\\/*?:"<>|]', "_", showTitle)

Hoping to avoid trying to find all instances of variables written to the XML file and adding this kind of line to them, if possible, and really hoping not to have to upgrade everything to Kodi 19 to get the python 3 version as that requires a full OS upgrade on my system.

Thanks

I just posted this point about my choice of fixes in a directly related issue. See:

https://github.com/edit4ever/script.module.zap2epg/issues/45#issuecomment-950413059

Also, I should mention I am fairly new to Python coding (and GitHub posting for that matter), so my solution may not be the most optimal way to code it. It seems to me that a single re.sub or an alternative that does multiple substitutions would be better. But this works for now and if I find a better way to code it, it will only have to be changed in the one place, xmlText routine.

jbreen60030 commented 2 years ago

Likewise, I followed up on Lorne's reply and added my own, which is geared towards the Python 2 versions.

On Sun, Oct 24, 2021 at 6:22 PM Lorne Nicol @.***> wrote:

Hi, I'm using an older, python 2, version of Zap2EPG and seeing the same problem. Is there an easy way to escape all text values written to the XML file?

I see this in the code for the title escape safeTitle = re.sub('[\/*?:"<>|]', "_", showTitle)

Hoping to avoid trying to find all instances of variables written to the XML file and adding this kind of line to them, if possible, and really hoping not to have to upgrade everything to Kodi 19 to get the python 3 version as that requires a full OS upgrade on my system.

Thanks

I just posted this point about my choice of fixes in a directly related issue. See:

45 (comment)

https://github.com/edit4ever/script.module.zap2epg/issues/45#issuecomment-950413059

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edit4ever/script.module.zap2epg/issues/44#issuecomment-950415221, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEYSPPHWLXEBFDMUOTDI3LUISIJ5ANCNFSM5GKAH6XA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Rippert commented 2 years ago

Thanks. I just implemented @Kensit solution. Seems to be working in my tests so far.

I'm sure @jbreen60030 solution would work, but I'm a newbie at Python also, and I want to have an obvious bit of code where I can see what is being replaced in case I need to debug.