def writeXMLTVConfig(self):

        if self.epgimport is None and self.xmltvimport is None and self.crossepg is None:
            return

        if int(self.epgimportversion[0]) >= 5 and int(
                self.xmltvimportversion[0]) >= 5 and int(
                    self.crossepgversion[0]) >= 5:
            return

        if config.plugins.seriesplugin.epgimport.value == False and config.plugins.seriesplugin.xmltvimport.value == False and config.plugins.seriesplugin.crossepg.value == False:
            return

        # Build Header
        from plugin import NAME, VERSION
        root = Element("sources")
        root.set('version', VERSION)
        root.set('created_by', NAME)
        root.append(
            Comment(
                _("Don't edit this manually unless you really know what you are doing"
                  )))

        element = SubElement(root,
                             "source",
                             type="gen_xmltv",
                             channels="wunschliste.channels.xml")

        SubElement(element, "description").text = "Wunschliste XMLTV"
        SubElement(element,
                   "url").text = config.plugins.seriesplugin.xmltv_url.value

        etree = ElementTree(root)

        indent(etree.getroot())

        if config.plugins.seriesplugin.epgimport.value:
            log.debug("Write: xml channels for epgimport")
            if self.epgimport:
                try:
                    self.epgimport.writeXML(etree)
                except Exception as e:
                    log.exception("Exception in write XML: " + str(e))

        if config.plugins.seriesplugin.xmltvimport.value:
            log.debug("Write: xml channels for xmltvimport")
            if self.xmltvimport:
                try:
                    self.xmltvimport.writeXML(etree)
                except Exception as e:
                    log.exception("Exception in write XML: " + str(e))

        if config.plugins.seriesplugin.crossepg.value:
            log.debug("Write: xml channels for crossepg")
            if self.crossepg:
                try:
                    self.crossepg.writeXML(etree)
                except Exception as e:
                    log.exception("Exception in write XML: " + str(e))
Beispiel #2
0
	def writeXMLTVConfig(self):
		
		if self.epgimport is None and self.xmltvimport is None and self.crossepg is None:
			return
		
		if int(self.epgimportversion[0]) >= 5 and int(self.xmltvimportversion[0]) >= 5 and int(self.crossepgversion[0]) >= 5:
			return;
		
		if config.plugins.seriesplugin.epgimport.value == False and config.plugins.seriesplugin.xmltvimport.value == False and config.plugins.seriesplugin.crossepg.value == False:
			return
		
		# Build Header
		from plugin import NAME, VERSION
		root = Element("sources")
		root.set('version', VERSION)
		root.set('created_by', NAME)
		root.append(Comment(_("Don't edit this manually unless you really know what you are doing")))
		
		element = SubElement( root, "source", type = "gen_xmltv", channels = "wunschliste.channels.xml" )
		
		SubElement( element, "description" ).text = "Wunschliste XMLTV"
		SubElement( element, "url" ).text = config.plugins.seriesplugin.xmltv_url.value
		
		etree = ElementTree( root )
		
		indent(etree.getroot())
		
		if config.plugins.seriesplugin.epgimport.value:
			log.debug("Write: xml channels for epgimport")
			if self.epgimport:
				try:
					self.epgimport.writeXML( etree )
				except Exception as e:
					log.exception("Exception in write XML: " + str(e))
		
		if config.plugins.seriesplugin.xmltvimport.value:
			log.debug("Write: xml channels for xmltvimport")
			if self.xmltvimport:
				try:
					self.xmltvimport.writeXML( etree )
				except Exception as e:
					log.exception("Exception in write XML: " + str(e))
		
		if config.plugins.seriesplugin.crossepg.value:
			log.debug("Write: xml channels for crossepg")
			if self.crossepg:
				try:
					self.crossepg.writeXML( etree )
				except Exception as e:
					log.exception("Exception in write XML: " + str(e))
    def saveXML(self):
        try:
            if ChannelsBase.channels_changed:

                ChannelsBase.channels_changed = False

                channels = ChannelsBase.channels

                # Generate List in RAM
                etree = None
                # logDebug("saveXML channels", channels)
                logDebug("SP saveXML channels", len(channels))

                # XMLTV compatible channels file
                # TEST Do we need to write the xml header node

                # Build Header
                from plugin import NAME, VERSION

                root = Element("channels")
                root.set("version", VERSION)
                root.set("created_by", NAME)
                root.append(Comment(_("Don't edit this manually unless you really know what you are doing")))

                # Build Body
                def build(root, channels):
                    if channels:
                        for reference, namealternatives in channels.iteritems():
                            name, alternatives = namealternatives[:]
                            if alternatives:
                                # Add channel
                                web = alternatives[0]
                                element = SubElement(root, "channel", name=stringToXML(name), id=stringToXML(web))
                                element.text = stringToXML(reference)
                                del alternatives[0]
                                if alternatives:
                                    for web in alternatives:
                                        SubElement(element, "web").text = stringToXML(web)
                    return root

                etree = ElementTree(build(root, channels))

                indent(etree.getroot())

                self.writeXML(etree)

                if config.plugins.seriesplugin.epgimport.value:
                    logDebug("Write: xml channels for epgimport")
                    try:
                        path = "/etc/epgimport/wunschliste.channels.xml"
                        etree.write(path, encoding="utf-8", xml_declaration=True)
                    except Exception as e:
                        logDebug("Exception in write XML: " + str(e))

                if config.plugins.seriesplugin.xmltvimport.value:
                    logDebug("Write: xml channels for xmltvimport")
                    try:
                        path = "/etc/xmltvimport/wunschliste.channels.xml"
                        etree.write(path, encoding="utf-8", xml_declaration=True)
                    except Exception as e:
                        logDebug("Exception in write XML: " + str(e))

        except Exception as e:
            logDebug("Exception in writeXML: " + str(e))
Beispiel #4
0
	def saveXML(self):
		try:
			if ChannelsBase.channels_changed:
				
				ChannelsBase.channels_changed = False
				
				channels = ChannelsBase.channels
				
				# Generate List in RAM
				etree = None
				#log.debug("saveXML channels", channels)
				log.debug("SP saveXML channels", len(channels))
				
				# XMLTV compatible channels file
				#TEST Do we need to write the xml header node
				
				# Build Header
				from plugin import NAME, VERSION
				root = Element("channels")
				root.set('version', VERSION)
				root.set('created_by', NAME)
				root.append(Comment(_("Don't edit this manually unless you really know what you are doing")))
				
				# Build Body
				def build(root, channels):
					if channels:
						for reference, namealternatives in channels.iteritems():
							name, alternatives = namealternatives[:]
							if alternatives:
								# Add channel
								web = alternatives[0]
								element = SubElement( root, "channel", name = stringToXML(name), id = stringToXML(web) )
								element.text = stringToXML(reference)
								del alternatives[0]
								if alternatives:
									for web in alternatives:
										SubElement( element, "web" ).text = stringToXML(web)
					return root
				
				etree = ElementTree( build( root, channels ) )
				
				indent(etree.getroot())
				
				self.writeXML( etree )
				
				if config.plugins.seriesplugin.epgimport.value:
					log.debug("Write: xml channels for epgimport")
					try:
						path = "/etc/epgimport/wunschliste.channels.xml"
						etree.write(path, encoding='utf-8', xml_declaration=True) 
					except Exception as e:
						log.exception("Exception in write XML: " + str(e))
				
				if config.plugins.seriesplugin.xmltvimport.value:
					log.debug("Write: xml channels for xmltvimport")
					try:
						path = "/etc/xmltvimport/wunschliste.channels.xml"
						etree.write(path, encoding='utf-8', xml_declaration=True) 
					except Exception as e:
						log.exception("Exception in write XML: " + str(e))
				
				if config.plugins.seriesplugin.crossepg.value:
					log.debug("Write: xml channels for crossepg")
					try:
						path = "/etc/crossepg/wunschliste.channels.xml"
						etree.write(path, encoding='utf-8', xml_declaration=True) 
					except Exception as e:
						log.exception("Exception in write XML: " + str(e))
				
		except Exception as e:
			log.exception("Exception in writeXML: " + str(e))