def makeXMLTV(self, data, filepath): self.log('makeXMLTV') finished = False if not FileAccess.exists(os.path.dirname(filepath)): FileAccess.mkdir(os.path.dirname(filepath)) if FileAccess.exists(filepath): FileAccess.delete(filepath) fle = open(filepath, "w") try: xml = data.toxml(encoding='UTF-8'); log('writing item: %s' % (filepath)) if FileAccess.exists(filepath): finished = True except Exception as e: xml = '<?xml version="1.0" encoding="UTF-8"?>' xml += '<error>' + str(e) + '</error>'; xmllst = xml.replace('><','>\n<') xmllst = self.cleanChanName(xmllst) fle.write("%s" % xmllst) fle.close() return finished