Example #1
0
	def read(self, provider_config):
		ret = False
		provider_key = provider_config.getProvider()
		bouquet_key = provider_config.getArea()
		
		if bouquet_key is not None and len(bouquet_key) > 0:
			print>>log, "[Manager] Reading %s (%s)..." % (provider_key, bouquet_key)
		else:
			print>>log, "[Manager] Reading %s..." % provider_key

		self.providerConfigs[provider_key] = provider_config

		providers = Providers().read()
		if provider_key in providers:
			if bouquet_key in providers[provider_key]["bouquets"] or providers[provider_key]["protocol"] != "sky":
				scanner = DvbScanner()
				scanner.setAdapter(self.adapter)
				scanner.setDemuxer(self.demuxer)
				scanner.setFrontend(self.frontend)
				scanner.setDVBType(providers[provider_key]["streamtype"])
				scanner.setNitPid(providers[provider_key]["transponder"]["nit_pid"])
				scanner.setNitCurrentTableId(providers[provider_key]["transponder"]["nit_current_table_id"])
				scanner.setNitOtherTableId(providers[provider_key]["transponder"]["nit_other_table_id"])

				if providers[provider_key]["protocol"] == "lcn":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])

					if providers[provider_key]["streamtype"] == 'dvbc':
						bouquet = providers[provider_key]["bouquets"][bouquet_key]
						tmp = scanner.updateTransponders(self.transponders, True, bouquet["netid"],bouquet["bouquettype"])
					else:
						tmp = scanner.updateTransponders(self.transponders, True)
					self.services[provider_key] = scanner.updateAndReadServicesLCN(
							providers[provider_key]["namespace"], self.transponders,
							providers[provider_key]["servicehacks"], tmp["transport_stream_id_list"],
							tmp["logical_channel_number_dict"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "fastscan":
					scanner.setFastscanPid(providers[provider_key]["transponder"]["fastscan_pid"])
					scanner.setFastscanTableId(providers[provider_key]["transponder"]["fastscan_table_id"])

					tmp = scanner.updateTransponders(self.transponders, True)
					self.services[provider_key] = scanner.updateAndReadServicesFastscan(
							providers[provider_key]["namespace"], self.transponders,
							providers[provider_key]["servicehacks"], tmp["transport_stream_id_list"],
							tmp["logical_channel_number_dict"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "sky":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])
					scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
					scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])

					scanner.updateTransponders(self.transponders, False)
					bouquet = providers[provider_key]["bouquets"][bouquet_key]
					self.services[provider_key] = scanner.updateAndReadServicesSKY(bouquet["bouquet"],
							bouquet["region"], bouquet["namespace"], self.transponders,
							providers[provider_key]["servicehacks"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "freesat":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])
					scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
					scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])

					scanner.updateTransponders(self.transponders, False)
					bouquet = providers[provider_key]["bouquets"][bouquet_key]
					self.services[provider_key] = scanner.updateAndReadServicesFreeSat(bouquet["bouquet"],
							bouquet["region"], bouquet["namespace"], self.transponders,
							providers[provider_key]["servicehacks"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())
				
				else:
					print>>log, "[Manager] Unsupported protocol %s" % providers[provider_key]["protocol"]
					ret = False

				if provider_key not in self.bouquetsOrder:
					self.bouquetsOrder.append(provider_key)
		print>>log, "[Manager] Done"
		return ret
Example #2
0
    def read(self, provider_config):
        ret = False
        provider_key = provider_config.getProvider()
        bouquet_key = provider_config.getArea()

        if bouquet_key is not None and len(bouquet_key) > 0:
            print >> log, "[Manager] Reading %s (%s)..." % (provider_key,
                                                            bouquet_key)
        else:
            print >> log, "[Manager] Reading %s..." % provider_key

        self.providerConfigs[provider_key] = provider_config

        providers = Providers().read()
        if provider_key in providers:
            if bouquet_key in providers[provider_key]["bouquets"] or providers[
                    provider_key]["protocol"] != "sky":
                scanner = DvbScanner()
                scanner.setAdapter(self.adapter)
                scanner.setDemuxer(self.demuxer)
                scanner.setFrontend(self.frontend)

                scanner.setNitPid(
                    providers[provider_key]["transponder"]["nit_pid"])
                scanner.setNitCurrentTableId(
                    providers[provider_key]["transponder"]
                    ["nit_current_table_id"])
                scanner.setNitOtherTableId(
                    providers[provider_key]["transponder"]
                    ["nit_other_table_id"])

                if providers[provider_key]["protocol"] == "lcn":
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])

                    tmp = scanner.updateTransponders(self.transponders, True)
                    self.services[
                        provider_key] = scanner.updateAndReadServicesLCN(
                            providers[provider_key]["namespace"],
                            self.transponders,
                            providers[provider_key]["servicehacks"],
                            tmp["transport_stream_id_list"],
                            tmp["logical_channel_number_dict"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "fastscan":
                    scanner.setFastscanPid(
                        providers[provider_key]["transponder"]["fastscan_pid"])
                    scanner.setFastscanTableId(
                        providers[provider_key]["transponder"]
                        ["fastscan_table_id"])

                    tmp = scanner.updateTransponders(self.transponders, True)
                    self.services[
                        provider_key] = scanner.updateAndReadServicesFastscan(
                            providers[provider_key]["namespace"],
                            self.transponders,
                            providers[provider_key]["servicehacks"],
                            tmp["transport_stream_id_list"],
                            tmp["logical_channel_number_dict"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "sky":
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])
                    scanner.setBatPid(
                        providers[provider_key]["transponder"]["bat_pid"])
                    scanner.setBatTableId(
                        providers[provider_key]["transponder"]["bat_table_id"])

                    scanner.updateTransponders(self.transponders, False)
                    bouquet = providers[provider_key]["bouquets"][bouquet_key]
                    self.services[
                        provider_key] = scanner.updateAndReadServicesSKY(
                            bouquet["bouquet"], bouquet["region"],
                            bouquet["namespace"], self.transponders,
                            providers[provider_key]["servicehacks"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "freesat":
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])
                    scanner.setBatPid(
                        providers[provider_key]["transponder"]["bat_pid"])
                    scanner.setBatTableId(
                        providers[provider_key]["transponder"]["bat_table_id"])

                    scanner.updateTransponders(self.transponders, False)
                    bouquet = providers[provider_key]["bouquets"][bouquet_key]
                    self.services[
                        provider_key] = scanner.updateAndReadServicesFreeSat(
                            bouquet["bouquet"], bouquet["region"],
                            bouquet["namespace"], self.transponders,
                            providers[provider_key]["servicehacks"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                else:
                    print >> log, "[Manager] Unsupported protocol %s" % providers[
                        provider_key]["protocol"]
                    ret = False

                if provider_key not in self.bouquetsOrder:
                    self.bouquetsOrder.append(provider_key)
        print >> log, "[Manager] Done"
        return ret
Example #3
0
	def read(self, provider_config):
		ret = False
		provider_key = provider_config.getProvider()
		bouquet_key = provider_config.getArea()

		if bouquet_key is not None and len(bouquet_key) > 0:
			print>>log, "[Manager] Reading %s (%s)..." % (provider_key, bouquet_key)
		else:
			print>>log, "[Manager] Reading %s..." % provider_key

		# read custom transponder file
		transponder_dict_tmp = {}
		transponder_tmp = {}
		transponder_dict_tmp = Tools().customtransponder(provider_key)
		if len(transponder_dict_tmp) > 0:
			for key in transponder_dict_tmp:
				if bouquet_key is not None and len(bouquet_key) > 0:
					if transponder_dict_tmp[key]["key"] == bouquet_key:
						transponder_tmp[key] = transponder_dict_tmp[key]
				else:
					transponder_tmp[key] = transponder_dict_tmp[key]

		self.providerConfigs[provider_key] = provider_config

		providers = Providers().read()
		if provider_key in providers:
			if bouquet_key in providers[provider_key]["bouquets"] or providers[provider_key]["protocol"] != "sky":
				scanner = DvbScanner()
				scanner.setAdapter(self.adapter)
				scanner.setDemuxer(self.demuxer)
				scanner.setFrontend(self.frontend)
				scanner.setDVBType(providers[provider_key]["streamtype"])
				scanner.setNitPid(providers[provider_key]["transponder"]["nit_pid"])
				scanner.setNitCurrentTableId(providers[provider_key]["transponder"]["nit_current_table_id"])
				scanner.setNitOtherTableId(providers[provider_key]["transponder"]["nit_other_table_id"])

				if providers[provider_key]["protocol"] == "lcn" or providers[provider_key]["protocol"] == "lcn2" or providers[provider_key]["protocol"] == "nolcn" or providers[provider_key]["protocol"] == "lcnbat":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])

					if providers[provider_key]["streamtype"] == 'dvbc':
						bouquet = providers[provider_key]["bouquets"][bouquet_key]
						tmp = scanner.updateTransponders(transponder_tmp, self.transponders, True, bouquet["netid"],bouquet["bouquettype"])
					else:
						tmp = scanner.updateTransponders(transponder_tmp, self.transponders, True)
					self.services[provider_key] = scanner.updateAndReadServicesLCN(
							providers[provider_key]["namespace"], self.transponders,
							providers[provider_key]["servicehacks"], tmp["transport_stream_id_list"],
							tmp["logical_channel_number_dict"], tmp["service_dict_tmp"], providers[provider_key]["protocol"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "fastscan":
					scanner.setFastscanPid(providers[provider_key]["transponder"]["fastscan_pid"])
					scanner.setFastscanTableId(providers[provider_key]["transponder"]["fastscan_table_id"])

					tmp = scanner.updateTransponders(transponder_tmp, self.transponders, True)
					self.services[provider_key] = scanner.updateAndReadServicesFastscan(
							providers[provider_key]["namespace"], self.transponders,
							providers[provider_key]["servicehacks"], tmp["transport_stream_id_list"],
							tmp["logical_channel_number_dict"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "sky":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])
					scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
					scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])

					scanner.updateTransponders(transponder_tmp, self.transponders, False)
					bouquet = providers[provider_key]["bouquets"][bouquet_key]
					self.services[provider_key] = scanner.updateAndReadServicesSKY(bouquet["bouquet"],
							bouquet["region"], bouquet["namespace"], bouquet["key"], self.transponders,
							providers[provider_key]["servicehacks"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "freesat":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])
					scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
					scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])

					scanner.updateTransponders(transponder_tmp, self.transponders, False)
					bouquet = providers[provider_key]["bouquets"][bouquet_key]
					self.services[provider_key] = scanner.updateAndReadServicesFreeSat(bouquet["bouquet"],
							bouquet["region"], bouquet["namespace"], bouquet["key"], self.transponders,
							providers[provider_key]["servicehacks"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				else:
					print>>log, "[Manager] Unsupported protocol %s" % providers[provider_key]["protocol"]
					ret = False

				if provider_key not in self.bouquetsOrder:
					self.bouquetsOrder.append(provider_key)

				# fta only
				if config.autobouquetsmaker.level.value == "expert" and provider_key in config.autobouquetsmaker.FTA_only.value:
					video_services_tmp = {}
					for number in self.services[provider_key]["video"]:
						if self.services[provider_key]["video"][number]["free_ca"] == 0:
							video_services_tmp[number] = self.services[provider_key]["video"][number]
					self.services[provider_key]["video"] = video_services_tmp

				# swap services if customLCN
				self.services[provider_key] = Tools().customLCN(self.services[provider_key], provider_key, self.providerConfigs[provider_key].getArea())

		print>>log, "[Manager] Done"
		return ret
Example #4
0
    def read(self, provider_config, providers, motorised):
        ret = False
        provider_key = provider_config.getProvider()
        bouquet_key = provider_config.getArea()

        if bouquet_key is not None and len(bouquet_key) > 0:
            print >> log, "[ABM-Manager][read] Reading %s (%s)..." % (
                provider_key, bouquet_key)
        else:
            print >> log, "[ABM-Manager][read] Reading %s..." % provider_key

        # read custom transponder
        customtransponders = {}
        if provider_key in providers and providers[provider_key][
                "streamtype"] == 'dvbt' and bouquet_key is not None and len(
                    bouquet_key) > 0:  # custom transponder is only for dvbt
            customtransponders = Tools().customtransponder(
                provider_key, bouquet_key)

        self.providerConfigs[provider_key] = provider_config

        #providers = Providers().read()
        if provider_key in providers:
            if bouquet_key in providers[provider_key]["bouquets"] or providers[
                    provider_key]["protocol"] != "sky":
                scanner = DvbScanner()
                scanner.setAdapter(self.adapter)
                scanner.setDemuxer(self.demuxer)
                scanner.setFrontend(self.frontend)
                scanner.setDVBType(providers[provider_key]["streamtype"])
                scanner.setNitPid(
                    providers[provider_key]["transponder"]["nit_pid"])
                scanner.setNitCurrentTableId(
                    providers[provider_key]["transponder"]
                    ["nit_current_table_id"])
                scanner.setNitOtherTableId(
                    providers[provider_key]["transponder"]
                    ["nit_other_table_id"])
                scanner.setVisibleServiceFlagIgnore(
                    providers[provider_key]["ignore_visible_service_flag"])

                if providers[provider_key]["protocol"] in ('lcn', 'lcn2',
                                                           'lcnbat', 'lcnbat2',
                                                           'nolcn', 'vmuk',
                                                           'vmuk2'):
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])

                    if motorised and not scanner.tsidOnidTest(
                            providers[provider_key]["transponder"]["onid"],
                            providers[provider_key]["transponder"]["tsid"]):
                        return False

                    try:
                        bouquet_id = providers[provider_key]["bouquets"][
                            bouquet_key]["bouquet"]
                    except:
                        bouquet_id = -1
                    if providers[provider_key]["streamtype"] == 'dvbc':
                        bouquet = providers[provider_key]["bouquets"][
                            bouquet_key]
                        tmp = scanner.updateTransponders(
                            self.transponders, True, customtransponders,
                            bouquet["netid"], bouquet["bouquettype"])
                    else:
                        tmp = scanner.updateTransponders(self.transponders,
                                                         True,
                                                         customtransponders,
                                                         bouquet_id=bouquet_id)
                    if providers[provider_key]["protocol"] in ("lcnbat",
                                                               "lcnbat2"):
                        scanner.setBatPid(
                            providers[provider_key]["transponder"]["bat_pid"])
                        scanner.setBatTableId(providers[provider_key]
                                              ["transponder"]["bat_table_id"])
                        tmp["logical_channel_number_dict"], tmp[
                            "TSID_ONID_list"] = scanner.readLCNBAT(
                                bouquet_id, providers[provider_key]["bouquets"]
                                [bouquet_key]["region"], tmp["TSID_ONID_list"])
                    self.services[
                        provider_key] = scanner.updateAndReadServicesLCN(
                            self.transponders,
                            providers[provider_key]["servicehacks"],
                            tmp["TSID_ONID_list"],
                            tmp["logical_channel_number_dict"],
                            tmp["service_dict_tmp"],
                            providers[provider_key]["protocol"], bouquet_key)

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "fastscan":
                    scanner.setFastscanPid(
                        providers[provider_key]["transponder"]["fastscan_pid"])
                    scanner.setFastscanTableId(
                        providers[provider_key]["transponder"]
                        ["fastscan_table_id"])

                    tmp = scanner.updateTransponders(self.transponders, True)
                    self.services[
                        provider_key] = scanner.updateAndReadServicesFastscan(
                            self.transponders,
                            providers[provider_key]["servicehacks"],
                            tmp["logical_channel_number_dict"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "sky":
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])
                    scanner.setBatPid(
                        providers[provider_key]["transponder"]["bat_pid"])
                    scanner.setBatTableId(
                        providers[provider_key]["transponder"]["bat_table_id"])

                    scanner.updateTransponders(self.transponders, False)
                    bouquet = providers[provider_key]["bouquets"][bouquet_key]
                    self.services[
                        provider_key] = scanner.updateAndReadServicesSKY(
                            bouquet["bouquet"], bouquet["region"],
                            bouquet["key"], self.transponders,
                            providers[provider_key]["servicehacks"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "freesat":
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])
                    scanner.setBatPid(
                        providers[provider_key]["transponder"]["bat_pid"])
                    scanner.setBatTableId(
                        providers[provider_key]["transponder"]["bat_table_id"])

                    scanner.updateTransponders(self.transponders, False)
                    bouquet = providers[provider_key]["bouquets"][bouquet_key]
                    self.services[
                        provider_key] = scanner.updateAndReadServicesFreeSat(
                            bouquet["bouquet"], bouquet["region"],
                            bouquet["key"], self.transponders,
                            providers[provider_key]["servicehacks"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                else:
                    print >> log, "[ABM-Manager][read] Unsupported protocol %s" % providers[
                        provider_key]["protocol"]
                    ret = False

                if provider_key not in self.bouquetsOrder:
                    if provider_key in config.autobouquetsmaker.providers.value:  # not a descendent provider
                        self.bouquetsOrder.append(provider_key)

        print >> log, "[ABM-Manager][read] %s, Done" % provider_key
        return ret
	def read(self, provider_config, providers, motorised):
		ret = False
		provider_key = provider_config.getProvider()
		bouquet_key = provider_config.getArea()

		if bouquet_key is not None and len(bouquet_key) > 0:
			print>>log, "[ABM-Manager][read] Reading %s (%s)..." % (provider_key, bouquet_key)
		else:
			print>>log, "[ABM-Manager][read] Reading %s..." % provider_key

		# read custom transponder
		customtransponders = {}
		if provider_key in providers and providers[provider_key]["streamtype"] == 'dvbt' and bouquet_key is not None and len(bouquet_key) > 0: # custom transponder is only for dvbt
			customtransponders = Tools().customtransponder(provider_key, bouquet_key)

		self.providerConfigs[provider_key] = provider_config

		#providers = Providers().read()
		if provider_key in providers:
			if bouquet_key in providers[provider_key]["bouquets"] or providers[provider_key]["protocol"] != "sky":
				scanner = DvbScanner()
				scanner.setAdapter(self.adapter)
				scanner.setDemuxer(self.demuxer)
				scanner.setFrontend(self.frontend)
				scanner.setDVBType(providers[provider_key]["streamtype"])
				scanner.setNitPid(providers[provider_key]["transponder"]["nit_pid"])
				scanner.setNitCurrentTableId(providers[provider_key]["transponder"]["nit_current_table_id"])
				scanner.setNitOtherTableId(providers[provider_key]["transponder"]["nit_other_table_id"])
				scanner.setVisibleServiceFlagIgnore(providers[provider_key]["ignore_visible_service_flag"])

				if providers[provider_key]["protocol"] in ('lcn', 'lcn2', 'lcnbat', 'lcnbat2', 'nolcn', 'vmuk', 'vmuk2'):
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])

					if motorised and not scanner.tsidOnidTest(providers[provider_key]["transponder"]["onid"], providers[provider_key]["transponder"]["tsid"]):
						return False

					try:
						bouquet_id = providers[provider_key]["bouquets"][bouquet_key]["bouquet"]
					except:
						bouquet_id = -1
					if providers[provider_key]["streamtype"] == 'dvbc':
						bouquet = providers[provider_key]["bouquets"][bouquet_key]
						tmp = scanner.updateTransponders(self.transponders, True, customtransponders, bouquet["netid"], bouquet["bouquettype"])
					else:
						tmp = scanner.updateTransponders(self.transponders, True, customtransponders, bouquet_id = bouquet_id)
					if providers[provider_key]["protocol"] in ("lcnbat", "lcnbat2"):
						scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
						scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])
						tmp["logical_channel_number_dict"], tmp["TSID_ONID_list"] = scanner.readLCNBAT(bouquet_id, providers[provider_key]["bouquets"][bouquet_key]["region"], tmp["TSID_ONID_list"])
					self.services[provider_key] = scanner.updateAndReadServicesLCN(
						self.transponders, providers[provider_key]["servicehacks"], tmp["TSID_ONID_list"],
						tmp["logical_channel_number_dict"], tmp["service_dict_tmp"], providers[provider_key]["protocol"], bouquet_key)

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "fastscan":
					scanner.setFastscanPid(providers[provider_key]["transponder"]["fastscan_pid"])
					scanner.setFastscanTableId(providers[provider_key]["transponder"]["fastscan_table_id"])

					tmp = scanner.updateTransponders(self.transponders, True)
					self.services[provider_key] = scanner.updateAndReadServicesFastscan(
							self.transponders, providers[provider_key]["servicehacks"],
							tmp["logical_channel_number_dict"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "sky":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])
					scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
					scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])

					scanner.updateTransponders(self.transponders, False)
					bouquet = providers[provider_key]["bouquets"][bouquet_key]
					self.services[provider_key] = scanner.updateAndReadServicesSKY(bouquet["bouquet"],
							bouquet["region"], bouquet["key"], self.transponders,
							providers[provider_key]["servicehacks"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "freesat":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])
					scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
					scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])

					scanner.updateTransponders(self.transponders, False)
					bouquet = providers[provider_key]["bouquets"][bouquet_key]
					self.services[provider_key] = scanner.updateAndReadServicesFreeSat(bouquet["bouquet"],
							bouquet["region"], bouquet["key"], self.transponders,
							providers[provider_key]["servicehacks"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				else:
					print>>log, "[ABM-Manager][read] Unsupported protocol %s" % providers[provider_key]["protocol"]
					ret = False

				if provider_key not in self.bouquetsOrder:
					if provider_key in config.autobouquetsmaker.providers.value: # not a descendent provider
						self.bouquetsOrder.append(provider_key)

		print>>log, "[ABM-Manager][read] %s, Done" % provider_key
		return ret
Example #6
0
    def read(self, provider_config):
        ret = False
        provider_key = provider_config.getProvider()
        bouquet_key = provider_config.getArea()

        if bouquet_key is not None and len(bouquet_key) > 0:
            print >> log, "[Manager] Reading %s (%s)..." % (provider_key,
                                                            bouquet_key)
        else:
            print >> log, "[Manager] Reading %s..." % provider_key

        # read custom transponder file
        transponder_dict_tmp = {}
        transponder_tmp = {}
        transponder_dict_tmp = Tools().customtransponder(provider_key)
        if len(transponder_dict_tmp) > 0:
            for key in transponder_dict_tmp:
                if bouquet_key is not None and len(bouquet_key) > 0:
                    if transponder_dict_tmp[key]["key"] == bouquet_key:
                        transponder_tmp[key] = transponder_dict_tmp[key]
                else:
                    transponder_tmp[key] = transponder_dict_tmp[key]

        self.providerConfigs[provider_key] = provider_config

        providers = Providers().read()
        if provider_key in providers:
            if bouquet_key in providers[provider_key]["bouquets"] or providers[
                    provider_key]["protocol"] != "sky":
                scanner = DvbScanner()
                scanner.setAdapter(self.adapter)
                scanner.setDemuxer(self.demuxer)
                scanner.setFrontend(self.frontend)
                scanner.setDVBType(providers[provider_key]["streamtype"])
                scanner.setNitPid(
                    providers[provider_key]["transponder"]["nit_pid"])
                scanner.setNitCurrentTableId(
                    providers[provider_key]["transponder"]
                    ["nit_current_table_id"])
                scanner.setNitOtherTableId(
                    providers[provider_key]["transponder"]
                    ["nit_other_table_id"])

                if providers[provider_key]["protocol"] == "lcn" or providers[
                        provider_key]["protocol"] == "lcn2" or providers[
                            provider_key]["protocol"] == "nolcn" or providers[
                                provider_key]["protocol"] == "lcnbat":
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])

                    if providers[provider_key]["streamtype"] == 'dvbc':
                        bouquet = providers[provider_key]["bouquets"][
                            bouquet_key]
                        tmp = scanner.updateTransponders(
                            transponder_tmp, self.transponders, True,
                            bouquet["netid"], bouquet["bouquettype"])
                    else:
                        tmp = scanner.updateTransponders(
                            transponder_tmp, self.transponders, True)
                    self.services[
                        provider_key] = scanner.updateAndReadServicesLCN(
                            providers[provider_key]["namespace"],
                            self.transponders,
                            providers[provider_key]["servicehacks"],
                            tmp["transport_stream_id_list"],
                            tmp["logical_channel_number_dict"],
                            tmp["service_dict_tmp"],
                            providers[provider_key]["protocol"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "fastscan":
                    scanner.setFastscanPid(
                        providers[provider_key]["transponder"]["fastscan_pid"])
                    scanner.setFastscanTableId(
                        providers[provider_key]["transponder"]
                        ["fastscan_table_id"])

                    tmp = scanner.updateTransponders(transponder_tmp,
                                                     self.transponders, True)
                    self.services[
                        provider_key] = scanner.updateAndReadServicesFastscan(
                            providers[provider_key]["namespace"],
                            self.transponders,
                            providers[provider_key]["servicehacks"],
                            tmp["transport_stream_id_list"],
                            tmp["logical_channel_number_dict"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "sky":
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])
                    scanner.setBatPid(
                        providers[provider_key]["transponder"]["bat_pid"])
                    scanner.setBatTableId(
                        providers[provider_key]["transponder"]["bat_table_id"])

                    scanner.updateTransponders(transponder_tmp,
                                               self.transponders, False)
                    bouquet = providers[provider_key]["bouquets"][bouquet_key]
                    self.services[
                        provider_key] = scanner.updateAndReadServicesSKY(
                            bouquet["bouquet"], bouquet["region"],
                            bouquet["namespace"], bouquet["key"],
                            self.transponders,
                            providers[provider_key]["servicehacks"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                elif providers[provider_key]["protocol"] == "freesat":
                    scanner.setSdtPid(
                        providers[provider_key]["transponder"]["sdt_pid"])
                    scanner.setSdtCurrentTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_current_table_id"])
                    scanner.setSdtOtherTableId(
                        providers[provider_key]["transponder"]
                        ["sdt_other_table_id"])
                    scanner.setBatPid(
                        providers[provider_key]["transponder"]["bat_pid"])
                    scanner.setBatTableId(
                        providers[provider_key]["transponder"]["bat_table_id"])

                    scanner.updateTransponders(transponder_tmp,
                                               self.transponders, False)
                    bouquet = providers[provider_key]["bouquets"][bouquet_key]
                    self.services[
                        provider_key] = scanner.updateAndReadServicesFreeSat(
                            bouquet["bouquet"], bouquet["region"],
                            bouquet["namespace"], bouquet["key"],
                            self.transponders,
                            providers[provider_key]["servicehacks"])

                    ret = len(self.services[provider_key]["video"].keys(
                    )) > 0 or len(
                        self.services[provider_key]["radio"].keys()) > 0

                    self.serviceVideoRead += len(
                        self.services[provider_key]["video"].keys())
                    self.serviceAudioRead += len(
                        self.services[provider_key]["radio"].keys())

                else:
                    print >> log, "[Manager] Unsupported protocol %s" % providers[
                        provider_key]["protocol"]
                    ret = False

                if provider_key not in self.bouquetsOrder:
                    self.bouquetsOrder.append(provider_key)

                # fta only
                if config.autobouquetsmaker.level.value == "expert" and provider_key in config.autobouquetsmaker.FTA_only.value:
                    video_services_tmp = {}
                    for number in self.services[provider_key]["video"]:
                        if self.services[provider_key]["video"][number][
                                "free_ca"] == 0:
                            video_services_tmp[number] = self.services[
                                provider_key]["video"][number]
                    self.services[provider_key]["video"] = video_services_tmp

                # swap services if customLCN
                self.services[provider_key] = Tools().customLCN(
                    self.services[provider_key], provider_key,
                    self.providerConfigs[provider_key].getArea())

        print >> log, "[Manager] Done"
        return ret
Example #7
0
	def read(self, provider_config, providers):
		ret = False
		provider_key = provider_config.getProvider()
		bouquet_key = provider_config.getArea()

		if bouquet_key is not None and len(bouquet_key) > 0:
			print>>log, "[Manager] Reading %s (%s)..." % (provider_key, bouquet_key)
		else:
			print>>log, "[Manager] Reading %s..." % provider_key

		# read custom transponder
		customtransponders = {}
		if bouquet_key is not None and len(bouquet_key) > 0:
			customtransponders = Tools().customtransponder(provider_key, bouquet_key)

		self.providerConfigs[provider_key] = provider_config

		#providers = Providers().read()
		if provider_key in providers:
			if bouquet_key in providers[provider_key]["bouquets"] or providers[provider_key]["protocol"] != "sky":
				scanner = DvbScanner()
				scanner.setAdapter(self.adapter)
				scanner.setDemuxer(self.demuxer)
				scanner.setFrontend(self.frontend)
				scanner.setDVBType(providers[provider_key]["streamtype"])
				scanner.setNitPid(providers[provider_key]["transponder"]["nit_pid"])
				scanner.setNitCurrentTableId(providers[provider_key]["transponder"]["nit_current_table_id"])
				scanner.setNitOtherTableId(providers[provider_key]["transponder"]["nit_other_table_id"])

				if providers[provider_key]["protocol"] in ('lcn', 'lcn2', 'nolcn', 'vmuk'):
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])

					if providers[provider_key]["streamtype"] == 'dvbc':
						bouquet = providers[provider_key]["bouquets"][bouquet_key]
						tmp = scanner.updateTransponders(self.transponders, True, customtransponders, bouquet["netid"],bouquet["bouquettype"])
					else:
						tmp = scanner.updateTransponders(self.transponders, True, customtransponders)
					if providers[provider_key]["protocol"] == 'vmuk':
						self.services[provider_key] = scanner.updateAndReadServicesVMUK(
								providers[provider_key]["namespace"], self.transponders,
								providers[provider_key]["servicehacks"], tmp["transport_stream_id_list"],
								tmp["service_dict_tmp"], bouquet_key)					
					else:
						self.services[provider_key] = scanner.updateAndReadServicesLCN(
								providers[provider_key]["namespace"], self.transponders,
								providers[provider_key]["servicehacks"], tmp["transport_stream_id_list"],
								tmp["logical_channel_number_dict"], tmp["service_dict_tmp"], providers[provider_key]["protocol"], bouquet_key)

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "fastscan":
					scanner.setFastscanPid(providers[provider_key]["transponder"]["fastscan_pid"])
					scanner.setFastscanTableId(providers[provider_key]["transponder"]["fastscan_table_id"])

					tmp = scanner.updateTransponders(self.transponders, True)
					self.services[provider_key] = scanner.updateAndReadServicesFastscan(
							providers[provider_key]["namespace"], self.transponders,
							providers[provider_key]["servicehacks"], tmp["transport_stream_id_list"],
							tmp["logical_channel_number_dict"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "sky":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])
					scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
					scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])

					scanner.updateTransponders(self.transponders, False)
					bouquet = providers[provider_key]["bouquets"][bouquet_key]
					self.services[provider_key] = scanner.updateAndReadServicesSKY(bouquet["bouquet"],
							bouquet["region"], bouquet["namespace"], bouquet["key"], self.transponders,
							providers[provider_key]["servicehacks"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				elif providers[provider_key]["protocol"] == "freesat":
					scanner.setSdtPid(providers[provider_key]["transponder"]["sdt_pid"])
					scanner.setSdtCurrentTableId(providers[provider_key]["transponder"]["sdt_current_table_id"])
					scanner.setSdtOtherTableId(providers[provider_key]["transponder"]["sdt_other_table_id"])
					scanner.setBatPid(providers[provider_key]["transponder"]["bat_pid"])
					scanner.setBatTableId(providers[provider_key]["transponder"]["bat_table_id"])

					scanner.updateTransponders(self.transponders, False)
					bouquet = providers[provider_key]["bouquets"][bouquet_key]
					self.services[provider_key] = scanner.updateAndReadServicesFreeSat(bouquet["bouquet"],
							bouquet["region"], bouquet["namespace"], bouquet["key"], self.transponders,
							providers[provider_key]["servicehacks"])

					ret = len(self.services[provider_key]["video"].keys()) > 0 or len(self.services[provider_key]["radio"].keys()) > 0

					self.serviceVideoRead += len(self.services[provider_key]["video"].keys())
					self.serviceAudioRead += len(self.services[provider_key]["radio"].keys())

				else:
					print>>log, "[Manager] Unsupported protocol %s" % providers[provider_key]["protocol"]
					ret = False

				if provider_key not in self.bouquetsOrder:
					if provider_key in config.autobouquetsmaker.providers.value: # not a descendent provider
						self.bouquetsOrder.append(provider_key)

		print>>log, "[Manager] Done"
		return ret