Skip to content

Commit

Permalink
Merge pull request #14 from jeremyjjbrown/Ampersand
Browse files Browse the repository at this point in the history
Escape Ampersand and carrots in channel.display-name
  • Loading branch information
daniel-widrick authored Sep 11, 2021
2 parents e99b32f + e059ad0 commit 3b7c324
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions zap2it-GuideScrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sys, getopt
#Libraries for historical copies
import datetime, os
from xml.sax.saxutils import escape

def sanitizeData(data):
#https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents
Expand All @@ -33,7 +34,7 @@ def buildXMLChannel(channel):
xml = xml + "\t\t" + '<display-name>' + html.unescape(channel["channelNo"] + " " + channel["callSign"]) + '</display-name>' + "\n"
xml = xml + "\t\t" + '<display-name>' + html.unescape(channel["channelNo"]) + '</display-name>' + "\n"
xml = xml + "\t\t" + '<display-name>' + html.unescape(channel["callSign"]) + '</display-name>' + "\n"
xml = xml + "\t\t" + '<display-name>' + html.unescape(channel["affiliateName"].title()) + '</display-name>' + "\n"
xml = xml + "\t\t" + '<display-name>' + escape(html.unescape(channel["affiliateName"].title())) + '</display-name>' + "\n"
xml = xml + "\t\t" + '<icon src="http:' + channel["thumbnail"].partition('?')[0] + '" />' + "\n"
xml = xml + "\t" + '</channel>' + "\n"
return xml
Expand All @@ -59,7 +60,7 @@ def buildXMLProgram(event,channelId):
xml = xml + "\t\t" + '<icon src="http://zap2it.tmsimg.com/assets/' + event["thumbnail"] + '.jpg" />' + "\n"

xml = xml + "\t\t" + '<url>https://tvlistings.zap2it.com//overview.html?programSeriesId=' + event["seriesId"] + '&amp;tmsId=' + event["program"]["id"] + '</url>' + "\n"

try:
#if "season" in event:
if event["program"]["season"] is not None:
Expand All @@ -72,7 +73,7 @@ def buildXMLProgram(event,channelId):

for category in event["filter"]:
xml = xml + "\t\t" + '<category lang="en">' + html.unescape(category.replace('filter-','')) + '</category>' + "\n"

#print season + "." + episode
if ((int(season) != 0) and (int(episode) != 0)):
xml = xml + "\t\t" + '<category lang="en">Series</category>' + "\n"
Expand Down Expand Up @@ -100,7 +101,7 @@ def buildXMLProgram(event,channelId):
xml = xml + "\t\t" + '<rating>' + "\n"
xml = xml + "\t\t\t" + '<value>' + event["rating"] + '</value>' + "\n"
xml = xml + "\t\t" + '</rating>' + "\n"

xml = xml + "\t" + '</programme>'+"\n"
return xml

Expand Down Expand Up @@ -187,7 +188,7 @@ def buildXMLDate(inputDateString):
'lineupId':'DFLTE',
'timespan':3,
'headendId': 'lineupId',
'country': Config.get("prefs","country"),
'country': Config.get("prefs","country"),
'device': '-',
'postalCode': Config.get("prefs","zipCode"),
'isOverride': "true",
Expand Down

0 comments on commit 3b7c324

Please sign in to comment.