예제 #1
0
    def loadXML(self):
        if not os_path.exists(self.filename):
            return

        def getValue(definitions, default):
            ret = ""
            Len = len(definitions)
            return Len > 0 and definitions[Len - 1].text or default

        self.read_services = []
        self.read_providers = []
        self.usingcaid = []
        self.ci_config = []

        try:
            fp = open(self.filename, 'r')
            tree = ci_parse(fp).getroot()
            fp.close()
            for slot in tree.findall("slot"):
                read_slot = getValue(slot.findall("id"), False).encode("UTF-8")
                print "ci " + read_slot

                i = 0
                for caid in slot.findall("caid"):
                    read_caid = caid.get("id").encode("UTF-8")
                    self.selectedcaid.append(
                        (str(read_caid), str(read_caid), i))
                    self.usingcaid.append(long(read_caid, 16))
                    i += 1

                for service in slot.findall("service"):
                    read_service_name = service.get("name").encode("UTF-8")
                    read_service_ref = service.get("ref").encode("UTF-8")
                    self.read_services.append(read_service_ref)

                for provider in slot.findall("provider"):
                    read_provider_name = provider.get("name").encode("UTF-8")
                    read_provider_dvbname = provider.get(
                        "dvbnamespace").encode("UTF-8")
                    self.read_providers.append(
                        (read_provider_name, read_provider_dvbname))

                self.ci_config.append(
                    (int(read_slot), (self.read_services, self.read_providers,
                                      self.usingcaid)))
        except:
            print "[CI_Config_CI%d] error parsing xml..." % self.ci_slot

        for item in self.read_services:
            if len(item):
                self.finishedChannelSelection(item)

        for item in self.read_providers:
            if len(item):
                self.finishedProviderSelection(item[0], item[1])

        print self.ci_config
        self.finishedCAidSelection(self.selectedcaid)
        self["ServiceList"].l.setList(self.servicelist)
        self.setServiceListInfo()
예제 #2
0
파일: plugin.py 프로젝트: regin92/enigma2
def activate_all(session):
    NUM_CI = eDVBCIInterfaces.getInstance().getNumOfSlots()
    print "[CI_Activate] FOUND %d CI Slots " % NUM_CI
    if NUM_CI > 0:
        ci_config = []

        def getValue(definitions, default):
            # Initialize Output
            ret = ""
            # How many definitions are present
            Len = len(definitions)
            return Len > 0 and definitions[Len - 1].text or default

        for ci in range(NUM_CI):
            filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml"

            if not os_path.exists(filename):
                print "[CI_Activate_Config_CI%d] no config file found" % ci

            try:
                if not os_path.exists(self.filename):
                    return

                fp = open(filename, "r")
                tree = ci_parse(fp).getroot()
                fp.close()
                read_services = []
                read_providers = []
                usingcaid = []
                for slot in tree.findall("slot"):
                    read_slot = getValue(slot.findall("id"), False).encode("UTF-8")

                    for caid in slot.findall("caid"):
                        read_caid = caid.get("id").encode("UTF-8")
                        usingcaid.append(long(read_caid, 16))

                    for service in slot.findall("service"):
                        read_service_ref = service.get("ref").encode("UTF-8")
                        read_services.append(read_service_ref)

                    for provider in slot.findall("provider"):
                        read_provider_name = provider.get("name").encode("UTF-8")
                        read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8")
                        read_providers.append((read_provider_name, long(read_provider_dvbname, 16)))

                    ci_config.append((int(read_slot), (read_services, read_providers, usingcaid)))
            except:
                print "[CI_Activate_Config_CI%d] error parsing xml..." % ci

        for item in ci_config:
            print "[CI_Activate] activate CI%d with following settings:" % item[0]
            print item[0]
            print item[1]
            try:
                eDVBCIInterfaces.getInstance().setDescrambleRules(item[0], item[1])
            except:
                print "[CI_Activate_Config_CI%d] error setting DescrambleRules..." % item[0]
예제 #3
0
파일: plugin.py 프로젝트: postla/enigma2
def activate_all(session):
	NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots()
	print "[CI_Activate] FOUND %d CI Slots " % NUM_CI
	if NUM_CI > 0:
		ci_config=[]
		def getValue(definitions, default):
			# Initialize Output
			ret = ""
			# How many definitions are present
			Len = len(definitions)
			return Len > 0 and definitions[Len-1].text or default

		for ci in range(NUM_CI):
			filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml"

			if not os_path.exists(filename):
				print "[CI_Activate_Config_CI%d] no config file found" %ci

			try:
				if not os_path.exists(self.filename):
					return

				fp = open(filename, 'r')
				tree = ci_parse(fp).getroot()
				fp.close()
				read_services=[]
				read_providers=[]
				usingcaid=[]
				for slot in tree.findall("slot"):
					read_slot = getValue(slot.findall("id"), False).encode("UTF-8")

					for caid in slot.findall("caid"):
						read_caid = caid.get("id").encode("UTF-8")
						usingcaid.append(long(read_caid,16))

					for service in slot.findall("service"):
						read_service_ref = service.get("ref").encode("UTF-8")
						read_services.append (read_service_ref)

					for provider in slot.findall("provider"):
						read_provider_name = provider.get("name").encode("UTF-8")
						read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8")
						read_providers.append((read_provider_name,long(read_provider_dvbname,16)))

					ci_config.append((int(read_slot), (read_services, read_providers, usingcaid)))
			except:
				print "[CI_Activate_Config_CI%d] error parsing xml..." %ci

		for item in ci_config:
			print "[CI_Activate] activate CI%d with following settings:" %item[0]
			print item[0]
			print item[1]
			try:
				eDVBCIInterfaces.getInstance().setDescrambleRules(item[0],item[1])
			except:
				print "[CI_Activate_Config_CI%d] error setting DescrambleRules..." %item[0]
예제 #4
0
	def loadXML(self):
		if not os_path.exists(self.filename):
			return

		def getValue(definitions, default):
			ret = ""
			Len = len(definitions)
			return Len > 0 and definitions[Len-1].text or default

		self.read_services=[]
		self.read_providers=[]
		self.usingcaid=[]
		self.ci_config=[]
		try:
			fp = open(self.filename, 'r')
			tree = ci_parse(fp).getroot()
			fp.close()

			for slot in tree.findall("slot"):
				read_slot = getValue(slot.findall("id"), False).encode("UTF-8")
				print "ci " + read_slot

				i=0
				for caid in slot.findall("caid"):
					read_caid = caid.get("id").encode("UTF-8")
					self.selectedcaid.append((str(read_caid),str(read_caid),i))
					self.usingcaid.append(long(read_caid,16))
					i+=1

				for service in  slot.findall("service"):
					read_service_name = service.get("name").encode("UTF-8")
					read_service_ref = service.get("ref").encode("UTF-8")
					self.read_services.append (read_service_ref)

				for provider in  slot.findall("provider"):
					read_provider_name = provider.get("name").encode("UTF-8")
					read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8")
					self.read_providers.append((read_provider_name,read_provider_dvbname))

				self.ci_config.append((int(read_slot), (self.read_services, self.read_providers, self.usingcaid)))
		except:
			print "[CI_Config_CI%d] error parsing xml..." %self.ci_slot

		for item in self.read_services:
			if len(item):
				self.finishedChannelSelection(item)

		for item in self.read_providers:
			if len(item):
				self.finishedProviderSelection(item[0],item[1])

		print self.ci_config
		self.finishedCAidSelection(self.selectedcaid)
		self["ServiceList"].l.setList(self.servicelist)
		self.setServiceListInfo()
예제 #5
0
파일: plugin.py 프로젝트: popazerty/12
def activate_all(session):
	NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots()
	print "[CI_Activate] FOUND %d CI Slots " % NUM_CI
	if NUM_CI > 0:
		ci_config=[]
		def getValue(definitions, default):
			# Initialize Output
			ret = ""
			# How many definitions are present
			Len = len(definitions)
			return Len > 0 and definitions[Len-1].text or default	

		for ci in range(NUM_CI):
			filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml"

			if not os_path.exists(filename):
				print "[CI_Activate_Config_CI%d] no config file found" %ci

			try:
				tree = ci_parse(filename).getroot()
				read_services=set()
				read_providers=set()
				usingcaid=set()
				for slot in tree.findall("slot"):
					read_slot = getValue(slot.findall("id"), False).encode("UTF-8")

					for caid in slot.findall("caid"):
						read_caid = caid.get("id").encode("UTF-8")
						usingcaid.add(int(read_caid,16))

					for service in slot.findall("service"):
						read_service_ref = service.get("ref").encode("UTF-8")
						read_services.add(eServiceReference(read_service_ref))

					for provider in slot.findall("provider"):
						read_provider_name = provider.get("name").encode("UTF-8")
						read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8")
						read_providers.add((read_provider_name,int(read_provider_dvbname,16)))

					ci_config.append((int(read_slot), (read_services, read_providers, usingcaid)))
			except IOError:
				print "[CI_Activate_Config_CI%d] error parsing xml..." %ci

		instance = eDVBCIInterfaces.getInstance()
		setProviderRules = instance.setProviderRules
		setCaidRules = instance.setCaidRules
		setServiceRules = instance.setServiceRules
		for item in ci_config:
			print "[CI_Activate] activate CI%d with following settings:" %item[0]
			print "services", [ x.toString() for x in item[1][0] ]
			print "providers", [ x for x in item[1][1] ]
			print "caids", [ x for x in item[1][2] ]
			setServiceRules(item[0], item[1][0]);
			setProviderRules(item[0], item[1][1]);
			setCaidRules(item[0], item[1][2]);
예제 #6
0
    def loadXML(self):
        if not os_path.exists(self.filename):
            return

        def getValue(definitions, default):
            ret = ''
            Len = len(definitions)
            return Len > 0 and definitions[Len - 1].text or default

        try:
            tree = ci_parse(self.filename).getroot()
            self.read_services = []
            self.read_providers = []
            self.usingcaid = []
            self.ci_config = []
            for slot in tree.findall('slot'):
                read_slot = getValue(slot.findall('id'), False).encode('UTF-8')
                print 'ci ' + read_slot
                i = 0
                for caid in slot.findall('caid'):
                    read_caid = caid.get('id').encode('UTF-8')
                    self.selectedcaid.append((str(read_caid), str(read_caid), i))
                    self.usingcaid.append(long(read_caid, 16))
                    i += 1

                for service in slot.findall('service'):
                    read_service_name = service.get('name').encode('UTF-8')
                    read_service_ref = service.get('ref').encode('UTF-8')
                    self.read_services.append(read_service_ref)

                for provider in slot.findall('provider'):
                    read_provider_name = provider.get('name').encode('UTF-8')
                    read_provider_dvbname = provider.get('dvbnamespace').encode('UTF-8')
                    self.read_providers.append((read_provider_name, read_provider_dvbname))

                self.ci_config.append((int(read_slot), (self.read_services, self.read_providers, self.usingcaid)))

        except:
            print '[CI_Config_CI%d] error parsing xml...' % self.ci_slot

        for item in self.read_services:
            if len(item):
                self.finishedChannelSelection(item)

        for item in self.read_providers:
            if len(item):
                self.finishedProviderSelection(item[0], item[1])

        print self.ci_config
        self.finishedCAidSelection(self.selectedcaid)
        self['ServiceList'].l.setList(self.servicelist)
        self.setServiceListInfo()
예제 #7
0
파일: plugin.py 프로젝트: Akki01/enigma2
def activate_all(session, editcallback=False):
	NUM_CI = eDVBCIInterfaces.getInstance().getNumOfSlots()
	print "[CI_Activate] FOUND %d CI Slots " % NUM_CI
	if NUM_CI and NUM_CI > 0:
		def getValue(definitions, default):
			# How many definitions are present
			Len = len(definitions)
			return Len > 0 and definitions[Len-1].text or default

		for ci in range(NUM_CI):
			filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml"

			if not os.path.exists(filename):
				print "[CI_Activate_Config_CI%d] no config file found" %ci
				continue

			try:
				tree = ci_parse(filename).getroot()
				read_services=[]
				read_providers=[]
				usingcaid=[]
				for slot in tree.findall("slot"):
					read_slot = getValue(slot.findall("id"), False).encode("UTF-8")

					for caid in slot.findall("caid"):
						read_caid = caid.get("id").encode("UTF-8")
						usingcaid.append(long(read_caid,16))

					for service in slot.findall("service"):
						read_service_ref = service.get("ref").encode("UTF-8")
						read_services.append (read_service_ref)

					for provider in slot.findall("provider"):
						read_provider_name = provider.get("name").encode("UTF-8")
						read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8")
						read_providers.append((read_provider_name,long(read_provider_dvbname,16)))

					if editcallback or (read_slot is not False and (read_services or read_providers or usingcaid)):
						print "[CI_Activate] activate CI%d with following settings:" % int(read_slot)
						print read_services, read_providers, usingcaid
						try:
							eDVBCIInterfaces.getInstance().setDescrambleRules(int(read_slot), (read_services, read_providers, usingcaid))
						except:
							print "[CI_Activate_Config_CI%d] error setting DescrambleRules..." % int(read_slot)
			except:
				print "[CI_Activate_Config_CI%d] error parsing xml..." % ci
				try:
					os.remove(filename)
				except:
					print "[CI_Activate_Config_CI%d] error remove damaged xml..." % ci
예제 #8
0
def activate_all(session, editcallback=False):
	NUM_CI = eDVBCIInterfaces.getInstance().getNumOfSlots()
	print "[CI_Activate] FOUND %d CI Slots " % NUM_CI
	if NUM_CI and NUM_CI > 0:
		def getValue(definitions, default):
			# How many definitions are present
			Len = len(definitions)
			return Len > 0 and definitions[Len-1].text or default	

		for ci in range(NUM_CI):
			filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml"

			if not os.path.exists(filename):
				print "[CI_Activate_Config_CI%d] no config file found" %ci
				continue

			try:
				tree = ci_parse(filename).getroot()
				read_services=[]
				read_providers=[]
				usingcaid=[]
				for slot in tree.findall("slot"):
					read_slot = getValue(slot.findall("id"), False).encode("UTF-8")

					for caid in slot.findall("caid"):
						read_caid = caid.get("id").encode("UTF-8")
						usingcaid.append(long(read_caid,16))

					for service in slot.findall("service"):
						read_service_ref = service.get("ref").encode("UTF-8")
						read_services.append (read_service_ref)

					for provider in slot.findall("provider"):
						read_provider_name = provider.get("name").encode("UTF-8")
						read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8")
						read_providers.append((read_provider_name,long(read_provider_dvbname,16)))

					if editcallback or (read_slot is not False and (read_services or read_providers or usingcaid)):
						print "[CI_Activate] activate CI%d with following settings:" % int(read_slot)
						print read_services, read_providers, usingcaid
						try:
							eDVBCIInterfaces.getInstance().setDescrambleRules(int(read_slot), (read_services, read_providers, usingcaid))
						except:
							print "[CI_Activate_Config_CI%d] error setting DescrambleRules..." % int(read_slot)
			except:
				print "[CI_Activate_Config_CI%d] error parsing xml..." % ci
				try:
					os.remove(filename)
				except:
					print "[CI_Activate_Config_CI%d] error remove damaged xml..." % ci
예제 #9
0
def activate_all(session):
    NUM_CI = eDVBCIInterfaces.getInstance().getNumOfSlots()
    print '[CI_Activate] FOUND %d CI Slots ' % NUM_CI
    if NUM_CI > 0:
        ci_config = []

        def getValue(definitions, default):
            ret = ''
            Len = len(definitions)
            return Len > 0 and definitions[Len - 1].text or default

        for ci in range(NUM_CI):
            filename = eEnv.resolve('${sysconfdir}/enigma2/ci') + str(ci) + '.xml'
            if not os_path.exists(filename):
                print '[CI_Activate_Config_CI%d] no config file found' % ci
            try:
                tree = ci_parse(filename).getroot()
                read_services = []
                read_providers = []
                usingcaid = []
                for slot in tree.findall('slot'):
                    read_slot = getValue(slot.findall('id'), False).encode('UTF-8')
                    for caid in slot.findall('caid'):
                        read_caid = caid.get('id').encode('UTF-8')
                        usingcaid.append(long(read_caid, 16))

                    for service in slot.findall('service'):
                        read_service_ref = service.get('ref').encode('UTF-8')
                        read_services.append(read_service_ref)

                    for provider in slot.findall('provider'):
                        read_provider_name = provider.get('name').encode('UTF-8')
                        read_provider_dvbname = provider.get('dvbnamespace').encode('UTF-8')
                        read_providers.append((read_provider_name, long(read_provider_dvbname, 16)))

                    ci_config.append((int(read_slot), (read_services, read_providers, usingcaid)))

            except:
                print '[CI_Activate_Config_CI%d] error parsing xml...' % ci

        for item in ci_config:
            print '[CI_Activate] activate CI%d with following settings:' % item[0]
            print item[0]
            print item[1]
            try:
                eDVBCIInterfaces.getInstance().setDescrambleRules(item[0], item[1])
            except:
                print '[CI_Activate_Config_CI%d] error setting DescrambleRules...' % item[0]
예제 #10
0
 def loadXML(self):
     # load the list
     print "[Volume Adjust] load xml..."
     if not os_path.exists(self.filen):
         return
     self.read_services = []
     self.read_volume = []
     try:
         tree = ci_parse(self.filen).getroot()
         for channels in tree.findall("channels"):
             for service in channels.findall("service"):
                 read_service_name = service.get("name").encode("UTF-8")
                 read_service_ref = service.get("ref").encode("UTF-8")
                 read_service_volume = service.get("volume").encode("UTF-8")
                 self.read_services.append(read_service_ref)
                 self.read_volume.append(read_service_volume)
     except:
         print "[Volume Adjust] error parsing xml..."
     for i in self.read_services:
         print i
예제 #11
0
파일: plugin.py 프로젝트: OUARGLA86/enigma2
	def loadXML(self):
		# load the list
		print "[Volume Adjust] load xml..."
		if not os_path.exists(self.filen):
			return
		self.read_services=[]
		self.read_volume=[]
		try:
			tree = ci_parse(self.filen).getroot()
			for channels in tree.findall("channels"):
				for service in  channels.findall("service"):
					read_service_name = service.get("name").encode("UTF-8")
					read_service_ref = service.get("ref").encode("UTF-8")
					read_service_volume = service.get("volume").encode("UTF-8")
					self.read_services.append (read_service_ref)
					self.read_volume.append (read_service_volume)
		except:
			print "[Volume Adjust] error parsing xml..."
		for i in self.read_services:
			print i
예제 #12
0
    def loadXML(self):
        print "[Volume Adjust] load xml..."
        if not os_path.exists(self.filename):
            return
        self.read_services = []
        self.read_volume = []
        try:
            tree = ci_parse(self.filename).getroot()
            for channels in tree.findall("channels"):
                for service in channels.findall("service"):
                    read_service_name = service.get("name").encode("UTF-8")
                    read_service_ref = service.get("ref").encode("UTF-8")
                    read_service_volume = service.get("volume").encode("UTF-8")
                    self.read_services.append(read_service_ref)
                    self.read_volume.append(read_service_volume)
        except:
            print "[Volume Adjust] error parsing xml..."

        for item in self.read_services:
            if len(item):
                self.finishedChannelSelection(item)
        self["ServiceList"].l.setList(self.servicelist)
예제 #13
0
파일: plugin.py 프로젝트: OUARGLA86/enigma2
	def loadXML(self):
		print "[Volume Adjust] load xml..."
		if not os_path.exists(self.filename):
			return
		self.read_services=[]
		self.read_volume=[]
		try:
			tree = ci_parse(self.filename).getroot()
			for channels in tree.findall("channels"):
				for service in  channels.findall("service"):
					read_service_name = service.get("name").encode("UTF-8")
					read_service_ref = service.get("ref").encode("UTF-8")
					read_service_volume = service.get("volume").encode("UTF-8")
					self.read_services.append (read_service_ref)
					self.read_volume.append (read_service_volume)
		except:
			print "[Volume Adjust] error parsing xml..."

		for item in self.read_services:
			if len(item):
				self.finishedChannelSelection(item)
		self["ServiceList"].l.setList(self.servicelist)
예제 #14
0
def activate_all(session):
    NUM_CI = eDVBCIInterfaces.getInstance().getNumOfSlots()
    print "[CI_Activate] FOUND %d CI Slots " % NUM_CI
    if NUM_CI > 0:
        ci_config = []

        def getValue(definitions, default):
            # Initialize Output
            ret = ""
            # How many definitions are present
            Len = len(definitions)
            return Len > 0 and definitions[Len - 1].text or default

        for ci in range(NUM_CI):
            filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(
                ci) + ".xml"

            if not os_path.exists(filename):
                print "[CI_Activate_Config_CI%d] no config file found" % ci

            try:
                tree = ci_parse(filename).getroot()
                read_services = set()
                read_providers = set()
                usingcaid = set()
                for slot in tree.findall("slot"):
                    read_slot = getValue(slot.findall("id"),
                                         False).encode("UTF-8")

                    for caid in slot.findall("caid"):
                        read_caid = caid.get("id").encode("UTF-8")
                        usingcaid.add(int(read_caid, 16))

                    for service in slot.findall("service"):
                        read_service_ref = service.get("ref").encode("UTF-8")
                        read_services.add(eServiceReference(read_service_ref))

                    for provider in slot.findall("provider"):
                        read_provider_name = provider.get("name").encode(
                            "UTF-8")
                        read_provider_dvbname = provider.get(
                            "dvbnamespace").encode("UTF-8")
                        read_providers.add(
                            (read_provider_name, int(read_provider_dvbname,
                                                     16)))

                    ci_config.append(
                        (int(read_slot), (read_services, read_providers,
                                          usingcaid)))
            except IOError:
                print "[CI_Activate_Config_CI%d] error parsing xml..." % ci

        instance = eDVBCIInterfaces.getInstance()
        setProviderRules = instance.setProviderRules
        setCaidRules = instance.setCaidRules
        setServiceRules = instance.setServiceRules
        for item in ci_config:
            print "[CI_Activate] activate CI%d with following settings:" % item[
                0]
            print "services", [x.toString() for x in item[1][0]]
            print "providers", [x for x in item[1][1]]
            print "caids", [x for x in item[1][2]]
            setServiceRules(item[0], item[1][0])
            setProviderRules(item[0], item[1][1])
            setCaidRules(item[0], item[1][2])