Ejemplo n.º 1
0
    def restoreSettings(self):
        filestodelete = ['/etc/enigma2/*.tv',
         '/etc/enigma2/*.radio',
         '/etc/enigma2/whitelist',
         '/etc/enigma2/blacklist',
         '/etc/enigma2/lamedb',
         '/etc/tuxbox/satellites.xml',
         '/etc/tuxbox/terrestrial.xml',
         '/etc/tuxbox/cables.xml']
        for deletefile in filestodelete:
            cmd = 'rm -f %s' % deletefile
            system(cmd)

        cmd = 'tar xzf %s -C /' % self.val
        system(cmd)
        try:
            nimmanager.readTransponders()
            eDVBDB.getInstance().reloadServicelist()
            eDVBDB.getInstance().reloadBouquets()
            infoBarInstance = InfoBar.instance
            if infoBarInstance is not None:
                servicelist = infoBarInstance.servicelist
                root = servicelist.getRoot()
                currentref = servicelist.getCurrentSelection()
                servicelist.setRoot(root)
                servicelist.setCurrentSelection(currentref)
            return True
        except:
            return False
Ejemplo n.º 2
0
	def writeFavouritesList(self):
		for root_type in ("tv", "radio"):
			f_content = []
			root_bouquet = "%sbouquets.%s" % (resolveFilename(SCOPE_CONFIG), root_type)
			if not fileExists(root_bouquet):
				if root_type == "radio":
					f_content = ["#NAME Bouquets (Radio)"]
					f_content.append("#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET \"userbouquet.favourites.radio\" ORDER BY bouquet")
				else:
					f_content = ["#NAME Bouquets (TV)"]
					f_content.append("#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET \"userbouquet.favourites.tv\" ORDER BY bouquet")
			else:
				with open(root_bouquet) as f:
					f_content = f.readlines()
				
			if root_type == "radio":
				f_list = self.bouquet_list_radio
			else:
				f_list = self.bouquet_list_tv
			if len(f_list):
				f = open(root_bouquet, "w+")
				if len(f_content):
					tmp = []
					for entry in f_content:
						entry = entry.replace('\n', '')
						entry = entry.replace('\r', '')
						tmp.append(entry)
						f.write(entry + '\n')
					f_content = tmp
				for entry in f_list:
					if entry not in f_content:
						f.write(entry + "\n")
				f.close()
		eDVBDB.getInstance().reloadBouquets()
Ejemplo n.º 3
0
	def addBouquet(self, bName, services):
		serviceHandler = eServiceCenter.getInstance()
		mutableBouquetList = serviceHandler.list(self.bouquet_root).startEdit()
		if mutableBouquetList:
			if self.mode == MODE_TV:
				bName += " (TV)"
				str = '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET \"userbouquet.%s.tv\" ORDER BY bouquet'%(self.buildBouquetID(bName))
			else:
				bName += " (Radio)"
				str = '1:7:2:0:0:0:0:0:0:0:FROM BOUQUET \"userbouquet.%s.radio\" ORDER BY bouquet'%(self.buildBouquetID(bName))
			new_bouquet_ref = eServiceReference(str)
			if not mutableBouquetList.addService(new_bouquet_ref):
				mutableBouquetList.flushChanges()
				eDVBDB.getInstance().reloadBouquets()
				mutableBouquet = serviceHandler.list(new_bouquet_ref).startEdit()
				if mutableBouquet:
					mutableBouquet.setListName(bName)
					if services is not None:
						for service in services:
							if mutableBouquet.addService(service):
								print "add", service.toString(), "to new bouquet failed"
					mutableBouquet.flushChanges()
				else:
					print "get mutable list for new created bouquet failed"
				# do some voodoo to check if current_root is equal to bouquet_root
				cur_root = self.getRoot();
				str1 = cur_root and cur_root.toString()
				pos1 = str1 and str1.find("FROM BOUQUET") or -1
				pos2 = self.bouquet_rootstr.find("FROM BOUQUET")
				if pos1 != -1 and pos2 != -1 and str1[pos1:] == self.bouquet_rootstr[pos2:]:
					self.servicelist.addService(new_bouquet_ref)
			else:
				print "add", str, "to bouquets failed"
		else:
			print "bouquetlist is not editable"
Ejemplo n.º 4
0
	def deleteConfirmed(self, confirmed):
		if confirmed is None:
			confirmed = (None, "no")

		if confirmed[1] == "yes" or confirmed[1] == "yestoall":
			eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove)

		if self.satpos_to_remove is not None:
			self.unconfed_sats.remove(self.satpos_to_remove)

		self.satpos_to_remove = None
		for orbpos in self.unconfed_sats:
			self.satpos_to_remove = orbpos
			orbpos = self.satpos_to_remove
			try:
				# why we need this cast?
				sat_name = str(nimmanager.getSatDescription(orbpos))
			except:
				if orbpos > 1800: # west
					orbpos = 3600 - orbpos
					h = _("W")
				else:
					h = _("E")
				sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)

			if confirmed[1] == "yes" or confirmed[1] == "no":
				# TRANSLATORS: The satellite with name '%s' is no longer used after a configuration change. The user is asked whether or not the satellite should be deleted.
				self.session.openWithCallback(self.deleteConfirmed, ChoiceBox, _("%s is no longer used. Should it be deleted?") %(sat_name), [(_("Yes"), "yes"), (_("No"), "no"), (_("Yes to all"), "yestoall"), (_("No to all"), "notoall")])
			if confirmed[1] == "yestoall" or confirmed[1] == "notoall":
				self.deleteConfirmed(confirmed)
			break
		else:
			self.restoreService(_("Zap back to service before tuner setup?"))
Ejemplo n.º 5
0
	def addAlternativeServices(self):
		cur_service = ServiceReference(self.getCurrentSelection())
		root = self.getRoot()
		cur_root = root and ServiceReference(root)
		mutableBouquet = cur_root.list().startEdit()
		if mutableBouquet:
			name = cur_service.getServiceName()
			print "NAME", name
			if self.mode == MODE_TV:
				str = '1:134:1:0:0:0:0:0:0:0:FROM BOUQUET \"alternatives.%s.tv\" ORDER BY bouquet'%(self.buildBouquetID(name))
			else:
				str = '1:134:2:0:0:0:0:0:0:0:FROM BOUQUET \"alternatives.%s.radio\" ORDER BY bouquet'%(self.buildBouquetID(name))
			new_ref = ServiceReference(str)
			if not mutableBouquet.addService(new_ref.ref, cur_service.ref):
				mutableBouquet.removeService(cur_service.ref)
				mutableBouquet.flushChanges()
				eDVBDB.getInstance().reloadBouquets()
				mutableAlternatives = new_ref.list().startEdit()
				if mutableAlternatives:
					mutableAlternatives.setListName(name)
					if mutableAlternatives.addService(cur_service.ref):
						print "add", cur_service.toString(), "to new alternatives failed"
					mutableAlternatives.flushChanges()
					self.servicelist.addService(new_ref.ref, True)
					self.servicelist.removeCurrent()
					self.servicelist.moveUp()
				else:
					print "get mutable list for new created alternatives failed"
			else:
				print "add", str, "to", cur_root.getServiceName(), "failed"
		else:
			print "bouquetlist is not editable"
Ejemplo n.º 6
0
	def deleteConfirmed(self, confirmed):
		if confirmed:
			eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove)

		if self.satpos_to_remove is not None:
			self.unconfed_sats.remove(self.satpos_to_remove)

		self.satpos_to_remove = None
		for orbpos in self.unconfed_sats:
			self.satpos_to_remove = orbpos
			orbpos = self.satpos_to_remove
			try:
				# why we need this cast?
				sat_name = str(nimmanager.getSatDescription(orbpos))
			except:
				if orbpos > 1800: # west
					orbpos = 3600 - orbpos
					h = _("W")
				else:
					h = _("E")
				sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)
			self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Delete no more configured satellite\n%s?") %(sat_name))
			break
		if not self.satpos_to_remove:
			self.close()
Ejemplo n.º 7
0
    def deleteConfirmed(self, confirmed):
        if confirmed is None:
            confirmed = (None, 'no')
        if confirmed[1] == 'yes' or confirmed[1] == 'yestoall':
            eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove)
        if self.satpos_to_remove is not None:
            self.unconfed_sats.remove(self.satpos_to_remove)
        self.satpos_to_remove = None
        for orbpos in self.unconfed_sats:
            self.satpos_to_remove = orbpos
            orbpos = self.satpos_to_remove
            try:
                sat_name = str(nimmanager.getSatDescription(orbpos))
            except:
                if orbpos > 1800:
                    orbpos = 3600 - orbpos
                    h = _('W')
                else:
                    h = _('E')
                sat_name = ('%d.%d' + h) % (orbpos / 10, orbpos % 10)

            if confirmed[1] == 'yes' or confirmed[1] == 'no':
                self.session.openWithCallback(self.deleteConfirmed, ChoiceBox, _('%s is no longer used. Should it be deleted?') % sat_name, [(_('Yes'), 'yes'),
                 (_('No'), 'no'),
                 (_('Yes to all'), 'yestoall'),
                 (_('No to all'), 'notoall')], None, 1)
            if confirmed[1] == 'yestoall' or confirmed[1] == 'notoall':
                self.deleteConfirmed(confirmed)
            break
        else:
            self.restoreService(_('Zap back to service before tuner setup?'))

        return
Ejemplo n.º 8
0
    def scanComplete(self):
        from Screens.Standby import inStandby

        if self.rawchannel:
            del (self.rawchannel)

        self.frontend = None
        self.rawchannel = None

        eDVBDB.getInstance().reloadServicelist()
        eDVBDB.getInstance().reloadBouquets()
        if self.postScanService:
            self.session.nav.playService(self.postScanService)
            self.postScanService = None
        self.progresscurrent += 1
        if not inStandby:
            self["progress"].setValue(self.progresscurrent)
            self["action"].setText(_("Done"))
            self["status"].setText(
                _("Services: %d video - %d radio")
                % (self.manager.getServiceVideoRead(), self.manager.getServiceAudioRead())
            )

        self.timer = eTimer()
        self.timer.callback.append(self.close)
        self.timer.start(2000, 1)
Ejemplo n.º 9
0
	def setCenterDvbSubs(self, configElement):
		if configElement.value:
			eDVBDB.getInstance().addFlag(eServiceReference(self.service_string), self.FLAG_CENTER_DVB_SUBS)
			config.subtitles.dvb_subtitles_centered.value = True
		else:
			eDVBDB.getInstance().removeFlag(eServiceReference(self.service_string), self.FLAG_CENTER_DVB_SUBS)
			config.subtitles.dvb_subtitles_centered.value = False
Ejemplo n.º 10
0
	def addBouquet(self, bName, mode, services):
		if config.usage.multibouquet.value:
			mutableBouquetList = self.getMutableBouquetList(mode)
			if mutableBouquetList:
				if mode == MODE_TV:
					bName += " (TV)"
					sref = '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET \"userbouquet.%s.tv\" ORDER BY bouquet'%(self.buildBouquetID(bName, "userbouquet.", mode))
				else:
					bName += " (Radio)"
					sref = '1:7:2:0:0:0:0:0:0:0:FROM BOUQUET \"userbouquet.%s.radio\" ORDER BY bouquet'%(self.buildBouquetID(bName, "userbouquet.", mode))
				new_bouquet_ref = eServiceReference(sref)
				if not mutableBouquetList.addService(new_bouquet_ref):
					mutableBouquetList.flushChanges()
					eDVBDB.getInstance().reloadBouquets()
					mutableBouquet = self.getMutableList(new_bouquet_ref)
					if mutableBouquet:
						mutableBouquet.setListName(bName)
						if services is not None:
							for service in services:
								if mutableBouquet.addService(service):
									print "add", service.toString(), "to new bouquet failed"
						mutableBouquet.flushChanges()
						self.setRoot(self.bouquet_rootstr)
						return (True, "Bouquet %s created." % bName)
					else:
						return (False, "Get mutable list for new created bouquet failed!")

				else:
					return (False, "Bouquet %s already exists." % bName)
			else:
				return (False, "Bouquetlist is not editable!")
		else:
			return (False, "Multi-Bouquet is not enabled!")
Ejemplo n.º 11
0
	def createBouquet(self):
		bouquetIndexContent = self.readBouquetIndex()
		if '"' + self.bouquetFilename + '"' not in bouquetIndexContent: # only edit the index if bouquet file is not present
			self.writeBouquetIndex(bouquetIndexContent)
		self.writeBouquet()

		eDVBDB.getInstance().reloadBouquets()
Ejemplo n.º 12
0
    def convert(self, raw):
        print "[e2Fetcher.fetchPage]: download done", raw
        new = open(self.CONFIG_DIR + self.BOUQUET, 'w')
        new.write('#NAME %s' % self.BOUQUET_NAME + '\n')
        try:
            with open(self.TEMP_FILE) as f:
                content = f.readlines()
                lines = iter(content)
                for line in lines:
                    for desc in self.DESCS:
                        if ("#DESCRIPTION %s" % desc) in line:
                            nl = lines.next()
                            if nl != '\n':
                                new.write(line)
                                new.write(nl)
        except Exception as e:
            self.session.open(MessageBox, text=e.message, type=MessageBox.TYPE_ERROR)
        finally:
            f.close()

        new.close()
        self.check_bouquettv()
        eDVBDB.getInstance().reloadBouquets()
        eDVBDB.getInstance().reloadServicelist()
        self.session.open(MessageBox, text=_("Bouquet updated"), type=MessageBox.TYPE_INFO)
Ejemplo n.º 13
0
	def deleteConfirmed(self, confirmed):
		if confirmed[1] == "yes" or confirmed[1] == "yestoall":
			eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove)

		if self.satpos_to_remove is not None:
			self.unconfed_sats.remove(self.satpos_to_remove)

		self.satpos_to_remove = None
		for orbpos in self.unconfed_sats:
			self.satpos_to_remove = orbpos
			orbpos = self.satpos_to_remove
			try:
				# why we need this cast?
				sat_name = str(nimmanager.getSatDescription(orbpos))
			except:
				if orbpos > 1800: # west
					orbpos = 3600 - orbpos
					h = _("W")
				else:
					h = _("E")
				sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)
				
			if confirmed[1] == "yes" or confirmed[1] == "no":
				self.session.openWithCallback(self.deleteConfirmed, ChoiceBox, _("Delete no more configured satellite\n%s?") %(sat_name), [(_("Yes"), "yes"), (_("No"), "no"), (_("Yes to all"), "yestoall"), (_("No to all"), "notoall")], allow_cancel = False)
			if confirmed[1] == "yestoall" or confirmed[1] == "notoall":
				self.deleteConfirmed(confirmed)
			break
		else:
			self.restoreService(_("Zap back to service before tuner setup?"))
Ejemplo n.º 14
0
 def cancel(self):
     if self.IPTVInstalled is True:
         infobox = self.session.open(MessageBox,_("Reloading Bouquets and Services..."), MessageBox.TYPE_INFO, timeout=5)
         infobox.setTitle(_("Info"))
         eDVBDB.getInstance().reloadBouquets()
         eDVBDB.getInstance().reloadServicelist()
     self.close()
Ejemplo n.º 15
0
	def installNext(self, *args, **kwargs):
		if self.reloadFavourites:
			self.reloadFavourites = False
			eDVBDB.getInstance().reloadBouquets()

		self.currentIndex += 1
		attributes = self.installingAttributes
		#print "attributes:", attributes
		
		if self.currentAttributeIndex >= len(self.attributeNames): # end of package reached
			print "end of package reached"
			if self.currentlyInstallingMetaIndex is None or self.currentlyInstallingMetaIndex >= len(self.installIndexes) - 1:
				print "set status to DONE"
				self.setStatus(self.STATUS_DONE)
				return
			else:
				print "increment meta index to install next package"
				self.currentlyInstallingMetaIndex += 1
				self.currentAttributeIndex = 0
				self.installPackage(self.installIndexes[self.currentlyInstallingMetaIndex])
				return
		
		self.setStatus(self.STATUS_WORKING)		
		
		print "currentAttributeIndex:", self.currentAttributeIndex
		currentAttribute = self.attributeNames[self.currentAttributeIndex]
		
		print "installing", currentAttribute, "with index", self.currentIndex
		
		if attributes.has_key(currentAttribute):
			if self.currentIndex >= len(attributes[currentAttribute]): # all jobs done for current attribute
				self.currentIndex = -1
				self.currentAttributeIndex += 1
				self.installNext()
				return
		else: # nothing to install here
			self.currentIndex = -1
			self.currentAttributeIndex += 1
			self.installNext()
			return
			
		if currentAttribute == "skin":
			skin = attributes["skin"][self.currentIndex]
			self.installSkin(skin["directory"], skin["name"])
		elif currentAttribute == "config":
			if self.currentIndex == 0:
				from Components.config import configfile
				configfile.save()
			configAttributes = attributes["config"][self.currentIndex]
			self.mergeConfig(configAttributes["directory"], configAttributes["name"])
		elif currentAttribute == "favourites":
			favourite = attributes["favourites"][self.currentIndex]
			self.installFavourites(favourite["directory"], favourite["name"])
		elif currentAttribute == "package":
			package = attributes["package"][self.currentIndex]
			self.installIPK(package["directory"], package["name"])
		elif currentAttribute == "services":
			service = attributes["services"][self.currentIndex]
			self.mergeServices(service["directory"], service["name"])
Ejemplo n.º 16
0
	def installchannel(self):
		self.hide()
		system("/etc/def_inst/install; mv /etc/def_inst /etc/.def_inst")
		self.session.open(MessageBox, _("Reloading bouquets and services..."), type = MessageBox.TYPE_INFO, timeout = 15, default = False)
		from enigma import eDVBDB
		eDVBDB.getInstance().reloadBouquets()
		eDVBDB.getInstance().reloadServicelist()
		self.close()
Ejemplo n.º 17
0
	def fechar(self):
		from enigma import eDVBDB
		import shutil
		eDVBDB.getInstance().reloadServicelist()
		try:
			shutil.rmtree(utils._picoZipDir,True)
		except:
			pass
Ejemplo n.º 18
0
 def settingRestore_Finished(self, result, retval, extra_args = None):
     self.didSettingsRestore = True
     eDVBDB.getInstance().reloadServicelist()
     eDVBDB.getInstance().reloadBouquets()
     self.session.nav.PowerTimer.loadTimer()
     self.session.nav.RecordTimer.loadTimer()
     configfile.load()
     self.pleaseWait.close()
     self.doRestorePlugins1()
Ejemplo n.º 19
0
	def removeSatelliteServices(self):
		curpath = self.csel.getCurrentSelection().getPath()
		idx = curpath.find("satellitePosition == ")
		if idx != -1:
			tmp = curpath[idx+21:]
			idx = tmp.find(')')
			if idx != -1:
				satpos = int(tmp[:idx])
				eDVBDB.getInstance().removeServices(-1, -1, -1, satpos)
		self.close()
Ejemplo n.º 20
0
	def removeAllNewFoundFlags(self):
		curpath = self.csel.getCurrentSelection().getPath()
		idx = curpath.find("satellitePosition == ")
		if idx != -1:
			tmp = curpath[idx+21:]
			idx = tmp.find(')')
			if idx != -1:
				satpos = int(tmp[:idx])
				eDVBDB.getInstance().removeFlags(FLAG_SERVICE_NEW_FOUND, -1, -1, -1, satpos)
		self.close()
Ejemplo n.º 21
0
	def hideBlacklist(self):
		if self.blacklist:
			if config.ParentalControl.servicepinactive.value and config.ParentalControl.storeservicepin.value != "never" and config.ParentalControl.hideBlacklist.value and not self.sessionPinCached:
				for ref in self.blacklist:
					if TYPE_BOUQUET not in ref:
						eDVBDB.getInstance().addFlag(eServiceReference(ref), 2)
			else:
				for ref in self.blacklist:
					if TYPE_BOUQUET not in ref:
						eDVBDB.getInstance().removeFlag(eServiceReference(ref), 2)
			refreshServiceList()
Ejemplo n.º 22
0
	def requestClose(self):
		if self.plugins_changed:
			plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		if self.reload_settings:
			self["text"].setText(_("Reloading bouquets and services..."))
			eDVBDB.getInstance().reloadBouquets()
			eDVBDB.getInstance().reloadServicelist()
		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.container.appClosed.remove(self.runFinished)
		self.container.dataAvail.remove(self.dataAvail)
		self.close()
Ejemplo n.º 23
0
    def render(self, request):
        request.setHeader('Content-type', 'application/xhtml+xml;')
        request.setHeader('charset', 'UTF-8')

        try:
            content = request.args['content'][0].replace(
                "<n/a>", self.undefinded_tag).replace('&', self.undefinded_and)
            if content.find('undefined') != -1:
                fp = open('/tmp/savedlist', 'w')
                fp.write(content)
                fp.close()
                result = """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n
						<e2simplexmlresult>\n
							<e2state>False</e2state>
							<e2statetext>found string 'undefined' in XML DATA... a copy was saved to '/tmp/savedlist'.</e2statetext>
						</e2simplexmlresult>\n
					 """
                request.setResponseCode(http.OK)
                request.write(result)

            (bouquets_tv, bouquets_radio) = self.parseXML(content)
            #print "having num %i TV Bouquets and num %i Radio Bouquets" %(len(bouquets_tv),len(bouquets_radio))

            #deleting old files
            for filename in glob(self.DIR + "userbouquet*.tv"):
                unlink(filename)
            for filename in glob(self.DIR + "userbouquet*.radio"):
                unlink(filename)
            for filename in ('bouquets.radio', 'bouquets.tv'):
                path = join(self.DIR, filename)
                if isfile(path):
                    unlink(path)

            #writing new files
            self.createIndexFile(self.TYPE_TV, bouquets_tv)
            counter = 0
            for bouquet in bouquets_tv:
                self.createBouquetFile(self.TYPE_TV, bouquet['bname'],
                                       bouquet['services'], counter)
                counter = counter + 1

            self.createIndexFile(self.TYPE_RADIO, bouquets_radio)
            counter = 0
            for bouquet in bouquets_radio:
                self.createBouquetFile(self.TYPE_RADIO, bouquet['bname'],
                                       bouquet['services'], counter)
                counter = counter + 1

            # reloading *.tv and *.radio
            db = eDVBDB.getInstance()
            db.reloadBouquets()
            print "servicelists reloaded"
            result = """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n
						<e2simplexmlresult>\n
							<e2state>True</e2state>
							<e2statetext>servicelist saved with %i TV und %i Radio Bouquets and was reloaded</e2statetext>
						</e2simplexmlresult>\n
					 """ % (len(bouquets_tv), len(bouquets_radio))

            request.setResponseCode(http.OK)
            request.write(result)

        except Exception, e:
            print e
            result = """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n
						<e2simplexmlresult>\n
							<e2state>False</e2state>
							<e2statetext>%s</e2statetext>
						</e2simplexmlresult>\n
					 """ % e

            request.setResponseCode(http.OK)
            request.write(result)
Ejemplo n.º 24
0
 def reloadPlugin(self):
     eDVBDB.getInstance().reloadServicelist()
     eDVBDB.getInstance().reloadBouquets()
     return
Ejemplo n.º 25
0
	def protectService(self, service):
		if service not in self.blacklist:
			self.serviceMethodWrapper(service, self.addServiceToList, self.blacklist)
			if config.ParentalControl.hideBlacklist.value and not self.sessionPinCached:
				eDVBDB.getInstance().addFlag(eServiceReference(service), 2)
Ejemplo n.º 26
0
    def __init__(self, session, infobar):
        Screen.__init__(self, session)
        self.skin = QuickSubtitlesConfigMenu.skin
        self.infobar = infobar or self.session.infobar
        self.wait = eTimer()
        self.wait.timeout.get().append(self.resyncSubtitles)
        self.resume = eTimer()
        self.resume.timeout.get().append(self.resyncSubtitlesResume)
        self.service = self.session.nav.getCurrentlyPlayingServiceReference()
        servicepath = self.service and self.service.getPath()
        if servicepath and servicepath.startswith(
                "/") and self.service.toString().startswith("1:"):
            info = eServiceCenter.getInstance().info(self.service)
            self.service_string = info and info.getInfoString(
                self.service, iServiceInformation.sServiceref)
        else:
            self.service_string = self.service.toString()
        self.center_dvb_subs = ConfigYesNo(
            default=(eDVBDB.getInstance().getFlag(
                eServiceReference(self.service_string))
                     & self.FLAG_CENTER_DVB_SUBS) and True)
        self.center_dvb_subs.addNotifier(self.setCenterDvbSubs)
        self["videofps"] = Label("")

        sub = self.infobar.selected_subtitle
        if sub[0] == 0:  # dvb
            menu = [
                getConfigMenuItem("config.subtitles.dvb_subtitles_yellow"),
                getConfigMenuItem("config.subtitles.dvb_subtitles_backtrans"),
                getConfigMenuItem(
                    "config.subtitles.dvb_subtitles_original_position"),
                (_("Center DVB subtitles"), self.center_dvb_subs),
                getConfigMenuItem("config.subtitles.subtitle_position"),
                getConfigMenuItem(
                    "config.subtitles.subtitle_bad_timing_delay"),
                getConfigMenuItem(
                    "config.subtitles.subtitle_noPTSrecordingdelay"),
            ]
        elif sub[0] == 1:  # teletext
            menu = [
                getConfigMenuItem("config.subtitles.ttx_subtitle_colors"),
                getConfigMenuItem(
                    "config.subtitles.ttx_subtitle_original_position"),
                getConfigMenuItem("config.subtitles.ttx_subtitle_position"),
                getConfigMenuItem("config.subtitles.subtitle_fontsize"),
                getConfigMenuItem("config.subtitles.subtitle_rewrap"),
                getConfigMenuItem("config.subtitles.subtitle_borderwidth"),
                getConfigMenuItem("config.subtitles.showbackground"),
                getConfigMenuItem("config.subtitles.subtitle_alignment"),
                getConfigMenuItem(
                    "config.subtitles.subtitle_bad_timing_delay"),
                getConfigMenuItem(
                    "config.subtitles.subtitle_noPTSrecordingdelay"),
            ]
        else:  # pango
            menu = [
                getConfigMenuItem("config.subtitles.pango_subtitles_delay"),
                getConfigMenuItem("config.subtitles.pango_subtitle_colors"),
                getConfigMenuItem(
                    "config.subtitles.pango_subtitle_fontswitch"),
                getConfigMenuItem("config.subtitles.colourise_dialogs"),
                getConfigMenuItem("config.subtitles.subtitle_fontsize"),
                getConfigMenuItem("config.subtitles.subtitle_position"),
                getConfigMenuItem("config.subtitles.subtitle_alignment"),
                getConfigMenuItem("config.subtitles.subtitle_rewrap"),
                getConfigMenuItem("config.subtitles.pango_subtitle_removehi"),
                getConfigMenuItem("config.subtitles.subtitle_borderwidth"),
                getConfigMenuItem("config.subtitles.showbackground"),
                getConfigMenuItem("config.subtitles.pango_subtitles_fps"),
            ]
            self["videofps"].setText(
                _("Video: %s fps") % (self.getFps().rstrip(".000")))

        ConfigListScreen.__init__(self,
                                  menu,
                                  self.session,
                                  on_change=self.changedEntry)

        self["actions"] = NumberActionMap(["SetupActions"], {
            "cancel": self.cancel,
            "ok": self.ok,
        }, -2)

        self.onLayoutFinish.append(self.layoutFinished)
Ejemplo n.º 27
0
 def addServiceToAlternative(self, param):
     sBouquetRef = param["sBouquetRef"]
     if sBouquetRef is None:
         return (False, "No bouquet given!")
     sRef = None
     if "sRef" in param:
         if param["sRef"] is not None:
             sRef = param["sRef"]  #  service to add to the alternative
     if sRef is None:
         return (False, _("No service given!"))
     sCurrentRef = param["sCurrentRef"]  #  alternative service
     if sCurrentRef is None:
         return (False, _("No current service given!"))
     cur_ref = eServiceReference(sCurrentRef)
     # check if  service is already an alternative
     if not (cur_ref.flags & eServiceReference.isGroup):
         # sCurrentRef is not an alternative service yet, so do this and add itself to new alternative liste
         mode = MODE_TV  # init
         if "mode" in param:
             if param["mode"] is not None:
                 mode = int(param["mode"])
         mutableBouquetList = self.getMutableList(
             eServiceReference(sBouquetRef))
         if mutableBouquetList:
             cur_service = ServiceReference(cur_ref)
             name = cur_service.getServiceName()
             if mode == MODE_TV:
                 sref = '1:134:1:0:0:0:0:0:0:0:FROM BOUQUET \"alternatives.%s.tv\" ORDER BY bouquet' % (
                     self.buildBouquetID(name, "alternatives.", mode))
             else:
                 sref = '1:134:2:0:0:0:0:0:0:0:FROM BOUQUET \"alternatives.%s.radio\" ORDER BY bouquet' % (
                     self.buildBouquetID(name, "alternatives.", mode))
             new_ref = eServiceReference(sref)
             if not mutableBouquetList.addService(new_ref, cur_ref):
                 mutableBouquetList.removeService(cur_ref)
                 mutableBouquetList.flushChanges()
                 eDVBDB.getInstance().reloadBouquets()
                 mutableAlternatives = self.getMutableList(new_ref)
                 if mutableAlternatives:
                     mutableAlternatives.setListName(name)
                     if mutableAlternatives.addService(cur_ref):
                         print "add", cur_ref.toString(
                         ), "to new alternatives failed"
                     mutableAlternatives.flushChanges()
                     self.setRoot(sBouquetRef)
                     sCurrentRef = sref  # currentRef is now an alternative (bouquet)
                 else:
                     return (
                         False,
                         _("Get mutable list for new created alternative failed!"
                           ))
             else:
                 return (False, _("Alternative %s created failed.") % name)
         else:
             return (False, _("Bouquetlist is not editable!"))
     # add service to alternative-bouquet
     new_param = {}
     new_param["sBouquetRef"] = sCurrentRef
     new_param["sRef"] = sRef
     returnValue = self.addServiceToBouquet(new_param)
     if returnValue[0]:
         cur_ref = eServiceReference(sCurrentRef)
         cur_service = ServiceReference(cur_ref)
         name = cur_service.getServiceName()
         service_ref = ServiceReference(sRef)
         service_name = service_ref.getServiceName()
         return (True, _("Added %s to alternative service %s.") %
                 (service_name, name))
     else:
         return returnValue
Ejemplo n.º 28
0
 def ipkgCallback(self, event, param):
     if event == IpkgComponent.EVENT_DOWNLOAD:
         self.status.setText(_("Downloading"))
     elif event == IpkgComponent.EVENT_UPGRADE:
         if self.sliderPackages.has_key(param):
             self.slider.setValue(self.sliderPackages[param])
         self.package.setText(param)
         self.status.setText(
             _("Upgrading") + ": %s/%s" %
             (self.packages, self.total_packages))
         if not param in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_INSTALL:
         self.package.setText(param)
         self.status.setText(_("Installing"))
         if not param in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_REMOVE:
         self.package.setText(param)
         self.status.setText(_("Removing"))
         if not param in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_CONFIGURING:
         self.package.setText(param)
         self.status.setText(_("Configuring"))
     elif event == IpkgComponent.EVENT_MODIFIED:
         if config.plugins.softwaremanager.overwriteConfigFiles.value in (
                 "N", "Y"):
             self.ipkg.write(
                 True and
                 config.plugins.softwaremanager.overwriteConfigFiles.value)
         else:
             self.session.openWithCallback(
                 self.modificationCallback, MessageBox,
                 _("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?"
                   ) % (param))
     elif event == IpkgComponent.EVENT_ERROR:
         self.error += 1
     elif event == IpkgComponent.EVENT_DONE:
         if self.updating:
             self.updating = False
             self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
         elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
             self.total_packages = len(self.ipkg.getFetchedList())
             if self.total_packages:
                 message = _(
                     "Do you want to update your receiver?") + "\n(" + (
                         ngettext("%s updated package available",
                                  "%s updated packages available",
                                  self.total_packages) %
                         self.total_packages) + ")"
                 choices = [(_("Update and reboot (recommended)"), "cold"),
                            (_("Update and ask to reboot"), "hot"),
                            (_("Update channel list only"), "channels"),
                            (_("Show updated packages"), "showlist")]
                 if not config.usage.show_update_disclaimer.value:
                     choices.append((_("Show disclaimer"), "disclaimer"))
                 choices.append((_("Cancel"), ""))
                 self.session.openWithCallback(self.startActualUpgrade,
                                               ChoiceBox,
                                               title=message,
                                               list=choices)
             else:
                 self.session.openWithCallback(self.close,
                                               MessageBox,
                                               _("No updates available"),
                                               type=MessageBox.TYPE_INFO,
                                               timeout=3,
                                               close_on_any_key=True)
         elif self.channellist_only > 0:
             if self.channellist_only == 1:
                 self.setEndMessage(
                     _("Could not find installed channel list."))
             elif self.channellist_only == 2:
                 self.slider.setValue(2)
                 self.ipkg.startCmd(IpkgComponent.CMD_REMOVE,
                                    {'package': self.channellist_name})
                 self.channellist_only += 1
             elif self.channellist_only == 3:
                 self.slider.setValue(3)
                 self.ipkg.startCmd(IpkgComponent.CMD_INSTALL,
                                    {'package': self.channellist_name})
                 self.channellist_only += 1
             elif self.channellist_only == 4:
                 self.showUpdateCompletedMessage()
                 eDVBDB.getInstance().reloadBouquets()
                 eDVBDB.getInstance().reloadServicelist()
         elif self.error == 0:
             self.showUpdateCompletedMessage()
         else:
             self.activityTimer.stop()
             self.activityslider.setValue(0)
             error = _(
                 "Your receiver might be unusable now. Please consult the manual for further assistance before rebooting your receiver."
             )
             if self.packages == 0:
                 error = _("No updates available. Please try again later.")
             if self.updating:
                 error = _(
                     "Update failed. Your receiver does not have a working internet connection."
                 )
             self.status.setText(_("Error") + " - " + error)
     elif event == IpkgComponent.EVENT_LISTITEM:
         if 'enigma2-plugin-settings-' in param[
                 0] and self.channellist_only > 0:
             self.channellist_name = param[0]
             self.channellist_only = 2
     #print event, "-", param
     pass
Ejemplo n.º 29
0
 def reloadLAMEDB(self):
     eDVBDB.getInstance().reloadServicelist()
     eDVBDB.getInstance().reloadBouquets()
Ejemplo n.º 30
0
 def ipkgCallback(self, event, param):
     if event == IpkgComponent.EVENT_DOWNLOAD:
         self.status.setText(_('Downloading'))
     elif event == IpkgComponent.EVENT_UPGRADE:
         if self.sliderPackages.has_key(param):
             self.slider.setValue(self.sliderPackages[param])
         self.package.setText(param)
         self.status.setText(
             _('Upgrading') + ': %s/%s' %
             (self.packages, self.total_packages))
         if param not in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_INSTALL:
         self.package.setText(param)
         self.status.setText(_('Installing'))
         if param not in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_REMOVE:
         self.package.setText(param)
         self.status.setText(_('Removing'))
         if param not in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_CONFIGURING:
         self.package.setText(param)
         self.status.setText(_('Configuring'))
     elif event == IpkgComponent.EVENT_MODIFIED:
         if config.plugins.softwaremanager.overwriteConfigFiles.value in (
                 'N', 'Y'):
             self.ipkg.write(
                 True and
                 config.plugins.softwaremanager.overwriteConfigFiles.value)
         else:
             self.session.openWithCallback(
                 self.modificationCallback, MessageBox,
                 _('A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?'
                   ) % param)
     elif event == IpkgComponent.EVENT_ERROR:
         self.error += 1
     elif event == IpkgComponent.EVENT_DONE:
         if self.updating:
             self.updating = False
             self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
         elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
             self.total_packages = len(self.ipkg.getFetchedList())
             if self.total_packages:
                 message = _('Do you want to update your receiver?'
                             ) + '\n(' + ngettext(
                                 '%s updated package available',
                                 '%s updated packages available', self.
                                 total_packages) % self.total_packages + ')'
                 if self.total_packages > 150:
                     message += ' ' + _('Reflash recommended!')
                 choices = [(_('Update and reboot (recommended)'), 'cold'),
                            (_('Update and ask to reboot'), 'hot'),
                            (_('Update channel list only'), 'channels'),
                            (_('Show packages to be upgraded'), 'showlist')]
             else:
                 message = _('No updates available')
                 choices = []
             if not config.usage.show_update_disclaimer.value:
                 choices.append((_('Show disclaimer'), 'disclaimer'))
             choices.append((_('Cancel'), ''))
             self.session.openWithCallback(self.startActualUpgrade,
                                           ChoiceBox,
                                           title=message,
                                           list=choices)
         elif self.channellist_only > 0:
             if self.channellist_only == 1:
                 self.setEndMessage(
                     _('Could not find installed channel list.'))
             elif self.channellist_only == 2:
                 self.slider.setValue(2)
                 self.ipkg.startCmd(IpkgComponent.CMD_REMOVE,
                                    {'package': self.channellist_name})
                 self.channellist_only += 1
             elif self.channellist_only == 3:
                 self.slider.setValue(3)
                 self.ipkg.startCmd(IpkgComponent.CMD_INSTALL,
                                    {'package': self.channellist_name})
                 self.channellist_only += 1
             elif self.channellist_only == 4:
                 self.showUpdateCompletedMessage()
                 eDVBDB.getInstance().reloadBouquets()
                 eDVBDB.getInstance().reloadServicelist()
         elif self.error == 0:
             self.showUpdateCompletedMessage()
         else:
             self.activityTimer.stop()
             self.activityslider.setValue(0)
             error = _(
                 'Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s.'
             ) % (getMachineBrand(), getMachineName(), getMachineBrand(),
                  getMachineName())
             if self.packages == 0:
                 error = _('No updates available. Please try again later.')
             if self.updating:
                 error = _(
                     'Update failed. Your %s %s does not have a working internet connection.'
                 ) % (getMachineBrand(), getMachineName())
             self.status.setText(_('Error') + ' - ' + error)
     elif event == IpkgComponent.EVENT_LISTITEM:
         if 'enigma2-plugin-settings-' in param[
                 0] and self.channellist_only > 0:
             self.channellist_name = param[0]
             self.channellist_only = 2
Ejemplo n.º 31
0
	def removeNewFoundFlag(self):
		eDVBDB.getInstance().removeFlag(self.csel.getCurrentSelection(), FLAG_SERVICE_NEW_FOUND)
		self.close()
Ejemplo n.º 32
0
	def hrestEn(self, answer):
		self.eDVBDB = eDVBDB.getInstance()
		self.eDVBDB.reloadServicelist()
		self.eDVBDB.reloadBouquets()
		self.session.open(TryQuitMainloop, 3)
Ejemplo n.º 33
0
	def reloadBouquets(self):
		eDVBDB.getInstance().reloadBouquets()
Ejemplo n.º 34
0
 def BuildLameDB(self):
     # ... teraz dodac to co potrzebujemy :)            
     eDVBDB.getInstance().loadServicelist('%scomponents/j00zekBouquets.lamedb' % PluginPath)
     eDVBDB.getInstance().saveServicelist()
Ejemplo n.º 35
0
 def reloadSettings(self):
     settings = eDVBDB.getInstance()
     settings.reloadServicelist()
     settings.reloadBouquets()
Ejemplo n.º 36
0
 def reloadSetting(self):
     print 'Reload settings'
     self.eDVBDB = eDVBDB.getInstance()
     self.eDVBDB.reloadServicelist()
     self.eDVBDB.reloadBouquets()
Ejemplo n.º 37
0
	def protectService(self, service):
		if service not in self.blacklist:
			self.serviceMethodWrapper(service, self.addServiceToList, self.blacklist)
			if config.ParentalControl.hideBlacklist.value and not self.sessionPinCached and config.ParentalControl.storeservicepin.value != "never":
				eDVBDB.getInstance().addFlag(eServiceReference(service), FLAG_IS_PARENTAL_PROTECTED_HIDDEN)
Ejemplo n.º 38
0
 def ipkgCallback(self, event, param):
     if event == IpkgComponent.EVENT_DOWNLOAD:
         self.status.setText(_("Downloading"))
     elif event == IpkgComponent.EVENT_UPGRADE:
         if param in self.sliderPackages:
             self.slider.setValue(self.sliderPackages[param])
         self.package.setText(param)
         self.status.setText(
             _("Upgrading") + ": %s/%s" %
             (self.packages, self.total_packages))
         if not param in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_INSTALL:
         self.package.setText(param)
         self.status.setText(_("Installing"))
         if not param in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_REMOVE:
         self.package.setText(param)
         self.status.setText(_("Removing"))
         if not param in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_CONFIGURING:
         self.package.setText(param)
         self.status.setText(_("Configuring"))
     elif event == IpkgComponent.EVENT_MODIFIED:
         if config.plugins.softwaremanager.overwriteConfigFiles.value in (
                 "N", "Y"):
             self.ipkg.write(
                 True and
                 config.plugins.softwaremanager.overwriteConfigFiles.value)
         else:
             self["actions"].setEnabled(True)
             self.session.openWithCallback(
                 self.modificationCallback, MessageBox,
                 _("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?"
                   ) % param)
     elif event == IpkgComponent.EVENT_ERROR:
         self.error += 1
         self.updating = False
     elif event == IpkgComponent.EVENT_DONE:
         if self.updating:
             self.updating = False
             self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
         elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
             self.total_packages = None
             if getImageType() != 'release' or (
                     config.softwareupdate.updateisunstable.value == '1'
                     and config.softwareupdate.updatebeta.value):
                 self.total_packages = len(self.ipkg.getFetchedList())
                 message = _(
                     "The current update may be unstable") + "\n" + _(
                         "Are you sure you want to update your %s %s ?"
                     ) % (getMachineBrand(), getMachineName()) + "\n(" + (
                         ngettext("%s updated package available",
                                  "%s updated packages available",
                                  self.total_packages) %
                         self.total_packages) + ")"
             elif config.softwareupdate.updateisunstable.value == '0':
                 self.total_packages = len(self.ipkg.getFetchedList())
                 message = _("Do you want to update your %s %s ?") % (
                     getMachineBrand(), getMachineName()) + "\n(" + (
                         ngettext("%s updated package available",
                                  "%s updated packages available",
                                  self.total_packages) %
                         self.total_packages) + ")"
             if self.total_packages > 150:
                 message += " " + _("Reflash recommended!")
             if self.total_packages:
                 global ocram
                 ocram = ''
                 for package_tmp in self.ipkg.getFetchedList():
                     if package_tmp[0].startswith(
                             'enigma2-plugin-picons-snp'):
                         ocram = ocram + '[ocram-picons] ' + package_tmp[
                             0].split(
                                 'enigma2-plugin-picons-snp-')[1].replace(
                                     '.', ' '
                                 ) + ' updated ' + package_tmp[2].replace(
                                     '--', ' ') + '\n'
                     elif package_tmp[0].startswith(
                             'enigma2-plugin-picons-srp'):
                         ocram = ocram + '[ocram-picons] ' + package_tmp[
                             0].split(
                                 'enigma2-plugin-picons-srp-')[1].replace(
                                     '.', ' '
                                 ) + ' updated ' + package_tmp[2].replace(
                                     '--', ' ') + '\n'
                 config.softwareupdate.updatefound.setValue(True)
                 choices = [(_("View the changes"), "changes"),
                            (_("Upgrade and reboot system"), "cold")]
                 if isPluginInstalled("ViX"):
                     if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
                         choices.append(
                             (_("Perform a settings backup,") + '\n\t' +
                              _("making a backup before updating") +
                              '\n\t' + _("is strongly advised."), "backup"))
                     if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                         choices.append((_("Perform a full image backup"),
                                         "imagebackup"))
                 choices.append((_("Update channel list only"), "channels"))
                 choices.append((_("Cancel"), ""))
                 self["actions"].setEnabled(True)
                 upgrademessage = self.session.openWithCallback(
                     self.startActualUpgrade,
                     UpdateChoices,
                     text=message,
                     list=choices,
                     skin_name="SoftwareUpdateChoices",
                     var=self.trafficLight)
                 upgrademessage.setTitle(self.getTitle())
             else:
                 message = _(
                     "No updates found, Press OK to exit this screen.")
                 choices = [(_("Nothing to upgrade"), "")]
                 self["actions"].setEnabled(True)
                 upgrademessage = self.session.openWithCallback(
                     self.startActualUpgrade,
                     UpdateChoices,
                     text=message,
                     list=choices,
                     skin_name="SoftwareUpdateChoices",
                     var=self.trafficLight)
                 upgrademessage.setTitle(self.getTitle())
         elif self.channellist_only > 0:
             if self.channellist_only == 1:
                 self.setEndMessage(
                     _("Could not find installed channel list."))
             elif self.channellist_only == 2:
                 self.slider.setValue(2)
                 self.ipkg.startCmd(IpkgComponent.CMD_REMOVE,
                                    {'package': self.channellist_name})
                 self.channellist_only += 1
             elif self.channellist_only == 3:
                 self.slider.setValue(3)
                 self.ipkg.startCmd(IpkgComponent.CMD_INSTALL,
                                    {'package': self.channellist_name})
                 self.channellist_only += 1
             elif self.channellist_only == 4:
                 self.showUpdateCompletedMessage()
                 eDVBDB.getInstance().reloadBouquets()
                 eDVBDB.getInstance().reloadServicelist()
         elif self.error == 0:
             self.showUpdateCompletedMessage()
         else:
             self.activityTimer.stop()
             self.activityslider.setValue(0)
             error = _(
                 "Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s."
             ) % (getMachineBrand(), getMachineName(), getMachineBrand(),
                  getMachineName())
             if self.packages == 0:
                 if self.error != 0:
                     error = _(
                         "Problem retrieving update list.\nIf this issue persists please check/report on forum"
                     )
                 else:
                     error = _(
                         "A background update check is in progress,\nplease wait a few minutes and try again."
                     )
             if self.updating:
                 error = _(
                     "Update failed. Your %s %s does not have a working internet connection."
                 ) % (getMachineBrand(), getMachineName())
             self.status.setText(_("Error") + " - " + error)
             self["actions"].setEnabled(True)
     elif event == IpkgComponent.EVENT_LISTITEM:
         if 'enigma2-plugin-settings-' in param[
                 0] and self.channellist_only > 0:
             self.channellist_name = param[0]
             self.channellist_only = 2
     #print event, "-", param
     pass
Ejemplo n.º 39
0
def refreshBouquets():
    eDVBDB.getInstance().reloadServicelist()
    eDVBDB.getInstance().reloadBouquets()
Ejemplo n.º 40
0
	def __init__(self, session):
		Source.__init__(self)
		self.session = session
		self.eDVBDB = eDVBDB.getInstance()
		self.res = False
Ejemplo n.º 41
0
 def keyGreen(self):
     if not self.hasFiles:
         return
     self.workList = []
     tmpList = []
     tmpList = self.list.getSelectionsList()
     if len(tmpList) == 0:
         self["statusbar"].setText(_("No bouquets selected"))
         return
     for item in tmpList:
         self.workList.append(item[1])
     fileValid = False
     state = 0
     fp = open(DIR_TMP + 'tmp_lamedb', 'w')
     try:
         fp2 = open(DIR_ENIGMA2 + 'lamedb')
         lines = fp2.readlines()
         fp2.close()
         for line in lines:
             if 'eDVB services' in line:
                 fileValid = True
             if state == 0:
                 if 'transponders' in line[:12]:
                     fp.write(line)
                 elif 'end' in line[:3]:
                     self.getTransponders(fp)
                     state = 1
                 else:
                     fp.write(line)
             elif state == 1:
                 if 'services' in line[:8]:
                     fp.write(line)
                 elif 'end' in line[:3]:
                     self.getServices(fp)
                     state = 2
                 else:
                     fp.write(line)
             elif state == 2:
                 fp.write(line)
     except:
         pass
     fp.close()
     if fileValid is not True:
         self.copyFile(DIR_TMP + 'lamedb', DIR_TMP + 'tmp_lamedb')
     tv = False
     radio = False
     for item in self.workList:
         if '.tv' in item:
             tv = True
         if '.radio' in item:
             radio = True
     if radio or tv:
         if tv:
             self.createBouquetFile(
                 DIR_TMP + 'tmp_bouquets.tv', DIR_ENIGMA2 + 'bouquets.tv',
                 '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET \"', '.tv')
         if radio:
             self.createBouquetFile(
                 DIR_TMP + 'tmp_bouquets.radio',
                 DIR_ENIGMA2 + 'bouquets.radio',
                 '#SERVICE 1:7:2:0:0:0:0:0:0:0:FROM BOUQUET \"', '.radio')
         self.copyFile(DIR_TMP + 'tmp_lamedb', DIR_ENIGMA2 + 'lamedb')
         db = eDVBDB.getInstance()
         db.reloadServicelist()
         self.convertBouquets()
         self.removeFiles(DIR_TMP, "tmp_")
         self.removeFiles(DIR_TMP, "lamedb")
         db = eDVBDB.getInstance()
         db.reloadServicelist()
         db.reloadBouquets()
     self.close()
Ejemplo n.º 42
0
	def __init__(self, session):
		self.skin = ServicesEditor.skin
		Screen.__init__(self, session)

		self.usk = None
		self.cur_service = None
		self.mainTitle = "ServicesEditor %s" %self.version
		self["actions"] = ActionMap(["ServicesEditorActions"],
			{
				"nextPage": self.nextPage,
				"nextPageUp": self.selectionKeyUp,
				"nextPageRepeated": self.nextPageRepeated,
				"prevPage": self.prevPage,
				"prevPageUp": self.selectionKeyUp,
				"prevPageRepeated": self.prevPageRepeated,
				"displayHelp": self.showHelp,
				"displayMenu": self.openMenu,
				"displayInfo": self.showServiceInfo,
				"select": self.editService,
				"exit": self.Exit,
				"left": self.left,
				"leftUp": self.doNothing,
				"leftRepeated": self.doNothing,
				"right": self.right,
				"rightUp": self.doNothing,
				"rightRepeated": self.doNothing,
				"upUp": self.selectionKeyUp,
				"up": self.up,
				"upRepeated": self.upRepeated,
				"down": self.down,
				"downUp": self.selectionKeyUp,
				"downRepeated": self.downRepeated,
				"redUp": self.hideService,
				"redLong": self.hideServiceMenu,
				"green": self.editService,
				"yellow": self.addService,
				"blue": self.sortColumn,
			}, -1)

		self["key_red"] = Button(_("hide/unhide"))
		self["key_green"] = Button(_("edit"))
		self["key_yellow"] = Button(_(" "))
		self["key_blue"] = Button(_("sort"))

		self["infolist"] = MenuList([])
		self["infolist"].l = eListboxPythonMultiContent()
		self["infolist"].l.setSelectionClip(eRect(0, 0, 0, 0))
		self["infolist"].l.setItemHeight(24);
		self["infolist"].l.setFont(0, gFont("Regular", 20))
		
		self["newscaster"] = Newscaster()
		self["head"] = Head()
		self["list"] = ServiceList()
		self.onLayoutFinish.append(self.layoutFinished)
		self.currentSelectedColumn = 1

		self.row = [
			["name", _("Services"), False],
			["provider", _("Providers"), False],
			["position", _("Pos"), False],
			]
		self.typesort = False
		
		self.myTimer = eTimer()
		db = eDVBDB.getInstance()
		db.saveServicelist()
		self.lamedb = Lamedb()
		self.database = self.lamedb.database
		self._initFlag = False
		self.gpsr = session.nav.getCurrentlyPlayingServiceReference().toString().lower()
		print_cy(self.gpsr)
		tmp = self.gpsr.split(":")
		if tmp[0]=="1" and tmp[1]=="0" and tmp[10]=="":
			self.usk = tmp[6].zfill(8)+tmp[4].zfill(4)+tmp[5].zfill(4)+tmp[3].zfill(4)
		print_cy(self.usk)
Ejemplo n.º 43
0
    def ipkgCallback(self, event, param):
        if event == IpkgComponent.EVENT_DOWNLOAD:
            self.status.setText(_("Downloading"))
        elif event == IpkgComponent.EVENT_UPGRADE:
            if self.sliderPackages.has_key(param):
                self.slider.setValue(self.sliderPackages[param])
            self.package.setText(param)
            self.status.setText(
                _("Upgrading") + ": %s/%s" %
                (self.packages, self.total_packages))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_INSTALL:
            self.package.setText(param)
            self.status.setText(_("Installing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_REMOVE:
            self.package.setText(param)
            self.status.setText(_("Removing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_CONFIGURING:
            self.package.setText(param)
            self.status.setText(_("Configuring"))

        elif event == IpkgComponent.EVENT_MODIFIED:
            if config.plugins.softwaremanager.overwriteConfigFiles.value in (
                    "N", "Y"):
                self.ipkg.write(
                    True and
                    config.plugins.softwaremanager.overwriteConfigFiles.value)
            else:
                self.session.openWithCallback(
                    self.modificationCallback, MessageBox,
                    _("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?"
                      ) % param)
        elif event == IpkgComponent.EVENT_ERROR:
            self.error += 1
        elif event == IpkgComponent.EVENT_DONE:
            if self.updating:
                self.updating = False
                self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
            elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
                from urllib import urlopen
                import socket
                currentTimeoutDefault = socket.getdefaulttimeout()
                socket.setdefaulttimeout(3)
                status = urlopen(
                    'http://www.openvix.co.uk/feeds/status').read()
                if '404 Not Found' in status:
                    status = '1'
                config.softwareupdate.updateisunstable.setValue(status)
                socket.setdefaulttimeout(currentTimeoutDefault)
                self.total_packages = None
                if config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value:
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _(
                        "The current update may be unstable") + "\n" + _(
                            "Are you sure you want to update your %s %s ?"
                        ) % (getMachineBrand(), getMachineName()) + "\n(" + (
                            ngettext("%s updated package available",
                                     "%s updated packages available",
                                     self.total_packages) %
                            self.total_packages) + ")"
                elif config.softwareupdate.updateisunstable.value == '0':
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _("Do you want to update your %s %s ?") % (
                        getMachineBrand(), getMachineName()) + "\n(" + (
                            ngettext("%s updated package available",
                                     "%s updated packages available",
                                     self.total_packages) %
                            self.total_packages) + ")"
                if self.total_packages:
                    global ocram
                    for package_tmp in self.ipkg.getFetchedList():
                        if package_tmp[0].startswith(
                                'enigma2-plugin-picons-tv-ocram'):
                            ocram = ocram + '[ocram-picons] ' + package_tmp[
                                0].split('enigma2-plugin-picons-tv-ocram.')[
                                    1] + 'updated ' + package_tmp[2] + '\n'
                        elif package_tmp[0].startswith(
                                'enigma2-plugin-settings-ocram'):
                            ocram = ocram + '[ocram-settings] ' + package_tmp[
                                0].split('enigma2-plugin-picons-tv-ocram.')[
                                    1] + 'updated ' + package_tmp[2] + '\n'
                    config.softwareupdate.updatefound.setValue(True)
                    choices = [(_("View the changes"), "changes"),
                               (_("Upgrade and reboot system"), "cold")]
                    if path.exists(
                            "/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/BackupManager.pyo"
                    ):
                        if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
                            choices.append(
                                (_("Perform a settings backup,") + '\n\t' +
                                 _("making a backup before updating") +
                                 '\n\t' + _("is strongly advised."), "backup"))
                        if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                            choices.append((_("Perform a full image backup"),
                                            "imagebackup"))
                    choices.append((_("Update channel list only"), "channels"))
                    choices.append((_("Cancel"), ""))
                    upgrademessage = self.session.openWithCallback(
                        self.startActualUpgrade,
                        ChoiceBox,
                        title=message,
                        list=choices,
                        skin_name="SoftwareUpdateChoices",
                        var=self.trafficLight)
                    upgrademessage.setTitle(_('Software update'))
                else:
                    upgrademessage = self.session.openWithCallback(
                        self.close,
                        MessageBox,
                        _("Nothing to upgrade"),
                        type=MessageBox.TYPE_INFO,
                        timeout=10,
                        close_on_any_key=True)
                    upgrademessage.setTitle(_('Software update'))
            elif self.channellist_only > 0:
                if self.channellist_only == 1:
                    self.setEndMessage(
                        _("Could not find installed channel list."))
                elif self.channellist_only == 2:
                    self.slider.setValue(2)
                    self.ipkg.startCmd(IpkgComponent.CMD_REMOVE,
                                       {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 3:
                    self.slider.setValue(3)
                    self.ipkg.startCmd(IpkgComponent.CMD_INSTALL,
                                       {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 4:
                    self.showUpdateCompletedMessage()
                    eDVBDB.getInstance().reloadBouquets()
                    eDVBDB.getInstance().reloadServicelist()
            elif self.error == 0:
                self.showUpdateCompletedMessage()
            else:
                self.activityTimer.stop()
                self.activityslider.setValue(0)
                error = _(
                    "Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s."
                ) % (getMachineBrand(), getMachineName(), getMachineBrand(),
                     getMachineName())
                if self.packages == 0:
                    error = _("No updates available. Please try again later.")
                if self.updating:
                    error = _(
                        "Update failed. Your %s %s does not have a working internet connection."
                    ) % (getMachineBrand(), getMachineName())
                self.status.setText(_("Error") + " - " + error)
        elif event == IpkgComponent.EVENT_LISTITEM:
            if 'enigma2-plugin-settings-' in param[
                    0] and self.channellist_only > 0:
                self.channellist_name = param[0]
                self.channellist_only = 2
        #print event, "-", param
        pass
Ejemplo n.º 44
0
    def readXML(self, xml):
        global ret
        self.session.nav.stopService()
        tlist = []
        self.path = "/etc/enigma2"
        lastsc1 = self.path + "/userbouquet.LastScanned.tv"
        favlist1 = self.path + "/bouquets.tv"
        newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
        if os.path.isfile(favlist1):
            f = open(favlist1, "a+")
            ret = f.read().split("\n")
            if newbouq11 in ret:
                yy = ret.index(newbouq11)
                ret.pop(yy)
            f.close()
            os.remove(favlist1)
        yx = [newbouq11]
        yx.extend(ret)
        yz = open(favlist1, "w")
        yz.write("\n".join(map(lambda x: str(x), yx)))
        yz.close()
        h = open('/etc/enigma2/userbouquet.LastScanned.tv', "w")
        h.write("#NAME Last Scanned\n")
        h.close()
        eDVBDB.getInstance().reloadBouquets()
        import xml.dom.minidom as minidom
        try:
            xmldoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + xml + ".xml"
            xmldoc = minidom.parse(xmldoc)
            tr_list = xmldoc.getElementsByTagName('transporder')
            for lista in tr_list:
                frequency = lista.getAttribute("frequency")
                symbolrate = lista.getAttribute("symbolrate")
                fec = lista.getAttribute("fec")
                orbpos = lista.getAttribute("orbpos")
                pol = lista.getAttribute("pol")
                system = lista.getAttribute("system")
                modulation = lista.getAttribute("modulation")

                self.frequency = frequency
                self.symbolrate = symbolrate
                if pol == "H":
                    pol = 0
                elif pol == "V":
                    pol = 1
                elif pol == "L":
                    pol = 2
                elif pol == "R":
                    pol = 3
                self.polarization = pol  # 0 - H, 1 - V, 2- CL, 3 - CR

                if fec == "Auto":
                    fec = 0
                elif fec == "1/2":
                    fec = 1
                elif fec == "2/3":
                    fec = 2
                elif fec == "3/4":
                    fec = 3
                elif fec == "3/5":
                    fec = 4
                elif fec == "4/5":
                    fec = 5
                elif fec == "5/6":
                    fec = 6
                elif fec == "7/8":
                    fec = 7
                elif fec == "8/9":
                    fec = 8
                elif fec == "9/10":
                    fec = 9

                self.fec = fec  # 0 - Auto, 1 - 1/2, 2 - 2/3, 3 - 3/4, 4 - 3/5, 5 - 4/5, 6 - 5/6, 7 - 7/8, 8 - 8/9 , 9 - 9/10,

                self.inversion = 2  # 0 - off, 1 -on, 2 - AUTO

                self.orbpos = orbpos

                if system == "DVBS":
                    system = 0
                elif system == "DVBS2":
                    system = 1

                self.system = system  # DVB-S = 0, DVB-S2 = 1

                if modulation == "QPSK":
                    modulation = 1
                elif modulation == "8PSK":
                    modulation = 2

                self.modulation = modulation  # 0- QPSK, 1 -8PSK

                self.rolloff = 0  #

                self.pilot = 2  # 0 - off, 1 - on 2 - AUTO

                self.addSatTransponder(tlist, int(self.frequency),
                                       int(self.symbolrate),
                                       int(self.polarization), int(fec),
                                       int(self.inversion), int(orbpos),
                                       int(self.system), int(self.modulation),
                                       int(self.rolloff), int(self.pilot))

            self.session.openWithCallback(
                self.bouqmake, ServiceScan, [{
                    "transponders": tlist,
                    "feid": int(self.scan_nims.value),
                    "flags": 0,
                    "networkid": 0
                }])
        except:
            #self.session.open(MessageBox, _("xml File missing, please check it."), MessageBox.TYPE_ERROR)
            print "xml File missing, please check it."
Ejemplo n.º 45
0
    def installNext(self, *args, **kwargs):
        if self.reloadFavourites:
            self.reloadFavourites = False
            db = eDVBDB.getInstance().reloadBouquets()

        self.currentIndex += 1
        attributes = self.installingAttributes
        #print "attributes:", attributes

        if self.currentAttributeIndex >= len(
                self.attributeNames):  # end of package reached
            print "end of package reached"
            if self.currentlyInstallingMetaIndex is None or self.currentlyInstallingMetaIndex >= len(
                    self.installIndexes) - 1:
                print "set status to DONE"
                self.setStatus(self.STATUS_DONE)
                return
            else:
                print "increment meta index to install next package"
                self.currentlyInstallingMetaIndex += 1
                self.currentAttributeIndex = 0
                self.installPackage(
                    self.installIndexes[self.currentlyInstallingMetaIndex])
                return

        self.setStatus(self.STATUS_WORKING)

        print "currentAttributeIndex:", self.currentAttributeIndex
        currentAttribute = self.attributeNames[self.currentAttributeIndex]

        print "installing", currentAttribute, "with index", self.currentIndex

        if attributes.has_key(currentAttribute):
            if self.currentIndex >= len(
                    attributes[currentAttribute]
            ):  # all jobs done for current attribute
                self.currentIndex = -1
                self.currentAttributeIndex += 1
                self.installNext()
                return
        else:  # nothing to install here
            self.currentIndex = -1
            self.currentAttributeIndex += 1
            self.installNext()
            return

        if currentAttribute == "skin":
            skin = attributes["skin"][self.currentIndex]
            self.installSkin(skin["directory"], skin["name"])
        elif currentAttribute == "config":
            if self.currentIndex == 0:
                from Components.config import configfile
                configfile.save()
            config = attributes["config"][self.currentIndex]
            self.mergeConfig(config["directory"], config["name"])
        elif currentAttribute == "favourites":
            favourite = attributes["favourites"][self.currentIndex]
            self.installFavourites(favourite["directory"], favourite["name"])
        elif currentAttribute == "package":
            package = attributes["package"][self.currentIndex]
            self.installIPK(package["directory"], package["name"])
        elif currentAttribute == "services":
            service = attributes["services"][self.currentIndex]
            self.mergeServices(service["directory"], service["name"])
Ejemplo n.º 46
0
    def bouqmake(self, session):
        prov = self.scan_provider.value.lower()
        global sname
        global ret
        ret1 = ret
        if prov == "sky_de_full":
            provlist = [
                'Sky_de_Bundesliga', 'Sky_de_Cinema', 'Sky_de_Entertainment',
                'Sky_de_Sport', 'Sky_de_Starter'
            ]
            for xprov in provlist:
                newprov = xprov
                self.path = "/etc/enigma2"
                lastsc = self.path + "/userbouquet.LastScanned.tv"
                newbouq = self.path + "/userbouquet." + newprov + ".tv"
                newbouq_unsort = self.path + "/userbouquet." + newprov + ".tv_unsort"
                favlist = self.path + "/bouquets.tv"
                newbouq_unsortlist = self.path + newbouq_unsort
                newbouq1 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.' + newprov + '.tv" ORDER BY bouquet\r'
                newbouq2 = '#NAME ' + newprov + ' '
                newbouq3 = '"userbouquet.' + newprov + '.tv"'
                newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
                path = self.path
                try:
                    txtdoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + newprov.lower(
                    ) + ".txt"
                    hh = []
                    gg = open(txtdoc, "r")
                    reta = gg.read().split("\n")
                    gg.close()
                    ff = open(lastsc, "r")
                    retb = ff.read().split("\n")
                    ff.close()
                    i = 1
                    wx = [newbouq2]
                    wx1 = [newbouq2]
                    if retb[1].startswith("#SERVICE"):
                        while i + 1 < len(retb):
                            self.updateServiceName(int(i))
                            if sname in reta:
                                wx.append(sname + " " + retb[i])

                            i += 1
                        wz = open(newbouq_unsort, "w")
                        wz.write("\n".join(map(lambda x: str(x), wx)))
                        wz.close()
                        for wwww in reta:
                            for s in wx:
                                www1 = s.rsplit("#", 1)
                                wwww1 = www1[0].rstrip()
                                if wwww1 == wwww:
                                    s1 = "#" + www1[1]
                                    wx1.append(s1)
                                    break
                        wz1 = open(newbouq, "w")
                        wz1.write("\n".join(map(lambda x: str(x), wx1)))
                        wz1.close()
                        rety = []
                        if os.path.isfile(favlist):
                            os.remove(favlist)
                        if os.path.isfile(newbouq_unsortlist):
                            os.remove(newbouq_unsortlist)
                        for zz in ret1:
                            if newbouq3 in zz:
                                print "no Service add"
                            else:
                                rety.append(zz)
                        rety[1:1] = [newbouq1]
                        ret1 = rety
                        wv = open(favlist, "w")
                        wv.write("\n".join(map(lambda x: str(x), rety)))
                        wv.close()
#eDVBDB.getInstance().reloadBouquets()
                    else:
                        wv = open(favlist, "w")
                        wv.write("\n".join(map(lambda x: str(x), ret1)))
                        wv.close()
                        #eDVBDB.getInstance().reloadBouquets()
                        self.keyCancel()
                except:
                    print 'My error, value:no xml found'
            eDVBDB.getInstance().reloadBouquets()
#####new
        elif prov in ('freesat_czech_republic', 'freesat_hungary',
                      'freesat_moldavia', 'freesat_slovenske'):
            self.path = "/etc/enigma2"
            lastsc = self.path + "/userbouquet.LastScanned.tv"
            newbouq = self.path + "/userbouquet." + self.scan_provider.value + ".tv"
            newbouq_unsort = self.path + "/userbouquet." + self.scan_provider.value + ".tv_unsort"
            favlist = self.path + "/bouquets.tv"
            newbouq_unsortlist = self.path + newbouq_unsort
            newbouq1 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.' + self.scan_provider.value + '.tv" ORDER BY bouquet\r'
            newbouq2 = '#NAME ' + self.scan_provider.value + ' '
            newbouq3 = '"userbouquet.' + self.scan_provider.value + '.tv"'
            newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
            path = self.path
            prefix = self.scan_provider.value
            try:
                txtdoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + self.scan_provider.value.lower(
                ) + ".txt"
                hh = []
                gg = open(txtdoc, "r")
                reta = gg.read().split("\n")
                gg.close()
                ff = open(lastsc, "r")
                retb = ff.read().split("\n")
                ff.close()
                i = 1
                wx = [newbouq2]
                wx1 = [newbouq2]
                if retb[1].startswith("#SERVICE"):
                    while i + 1 < len(retb):
                        self.updateServiceName(int(i))
                        if sname in reta:
                            wx.append(sname + " " + retb[i])

                        i += 1
                    wz = open(newbouq_unsort, "w")
                    wz.write("\n".join(map(lambda x: str(x), wx)))
                    wz.close()
                    for wwww in reta:
                        for s in wx:
                            www1 = s.rsplit("#", 1)
                            wwww1 = www1[0].rstrip()
                            if wwww1 == wwww:
                                s1 = "#" + www1[1]
                                wx1.append(s1)
                                break
                    wz1 = open(newbouq, "w")
                    wz1.write("\n".join(map(lambda x: str(x), wx1)))
                    wz1.close()

                    rety = []
                    if os.path.isfile(favlist):
                        os.remove(favlist)
                    if os.path.isfile(newbouq_unsortlist):
                        os.remove(newbouq_unsortlist)
                    for zz in ret:
                        if newbouq3 in zz:
                            print "no Service add"
                        else:
                            rety.append(zz)
                    rety[1:1] = [newbouq1]
                    wv = open(favlist, "w")
                    wv.write("\n".join(map(lambda x: str(x), rety)))
                    wv.close()
                    os.system(
                        'cp /usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/bouq/'
                        + newbouq3 + ' /etc/enigma2/')
                    eDVBDB.getInstance().reloadBouquets()

                else:
                    wv = open(favlist, "w")
                    wv.write("\n".join(map(lambda x: str(x), ret)))
                    wv.close()
                    eDVBDB.getInstance().reloadBouquets()
                    self.keyCancel()
            except:
                print 'My error, value:no xml found'
#self.session.open(MessageBox, _("Chanel-txt File missing, please check it."), MessageBox.TYPE_ERROR)
###new end

        else:
            self.path = "/etc/enigma2"
            lastsc = self.path + "/userbouquet.LastScanned.tv"
            newbouq = self.path + "/userbouquet." + self.scan_provider.value + ".tv"
            newbouq_unsort = self.path + "/userbouquet." + self.scan_provider.value + ".tv_unsort"
            favlist = self.path + "/bouquets.tv"
            newbouq_unsortlist = self.path + newbouq_unsort
            newbouq1 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.' + self.scan_provider.value + '.tv" ORDER BY bouquet\r'
            newbouq2 = '#NAME ' + self.scan_provider.value + ' '
            newbouq3 = '"userbouquet.' + self.scan_provider.value + '.tv"'
            newbouq11 = '#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.LastScanned.tv" ORDER BY bouquet'
            path = self.path
            prefix = self.scan_provider.value
            try:
                txtdoc = "/usr/lib/enigma2/python/Plugins/SystemPlugins/FastScan/xml/" + self.scan_provider.value.lower(
                ) + ".txt"
                hh = []
                gg = open(txtdoc, "r")
                reta = gg.read().split("\n")
                gg.close()
                ff = open(lastsc, "r")
                retb = ff.read().split("\n")
                ff.close()
                i = 1
                wx = [newbouq2]
                wx1 = [newbouq2]
                if retb[1].startswith("#SERVICE"):
                    while i + 1 < len(retb):
                        self.updateServiceName(int(i))
                        if sname in reta:
                            wx.append(sname + " " + retb[i])

                        i += 1
                    wz = open(newbouq_unsort, "w")
                    wz.write("\n".join(map(lambda x: str(x), wx)))
                    wz.close()
                    for wwww in reta:
                        for s in wx:
                            www1 = s.rsplit("#", 1)
                            wwww1 = www1[0].rstrip()
                            if wwww1 == wwww:
                                s1 = "#" + www1[1]
                                wx1.append(s1)
                                break
                    wz1 = open(newbouq, "w")
                    wz1.write("\n".join(map(lambda x: str(x), wx1)))
                    wz1.close()

                    rety = []
                    if os.path.isfile(favlist):
                        os.remove(favlist)
                    if os.path.isfile(newbouq_unsortlist):
                        os.remove(newbouq_unsortlist)
                    for zz in ret:
                        if newbouq3 in zz:
                            print "no Service add"
                        else:
                            rety.append(zz)
                    rety[1:1] = [newbouq1]
                    wv = open(favlist, "w")
                    wv.write("\n".join(map(lambda x: str(x), rety)))
                    wv.close()
                    eDVBDB.getInstance().reloadBouquets()

                else:
                    wv = open(favlist, "w")
                    wv.write("\n".join(map(lambda x: str(x), ret)))
                    wv.close()
                    eDVBDB.getInstance().reloadBouquets()
                    self.keyCancel()
            except:
                print 'My error, value:no xml found'
Ejemplo n.º 47
0
    def getinput(self):
        try:
            req = requests.session()
            page = req.get(
                "http://streaming.media.ccc.de/streams/v2.json",
                headers={
                    'User-Agent':
                    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36'
                })
            data = json.loads(page.content)

            with open("/tmp/c3voc", "a") as myfile:
                myfile.write("#NAME c3voc (TV)\n")
                myfile.close()

            for conference in data:
                conference_name = conference["conference"]
                for group in conference["groups"]:
                    rooms = group["rooms"]
                    if not rooms:
                        continue

                    for room in rooms:
                        schedule_name = room["schedulename"]
                        url = self.get_hls_url(room["streams"], "hd-native")
                        page = req.get(
                            url,
                            headers={
                                'User-Agent':
                                'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36'
                            })
                        page.content
                        streamurl = re.findall('#EXT-X-STREAM-INF.*?\n(.*?)\n',
                                               page.content, re.S)
                        if not streamurl[0].startswith('http'):
                            streamurl = url.rsplit('/',
                                                   1)[0] + '/' + streamurl[0]
                        else:
                            streamurl = streamurl[0]
                        with open("/tmp/c3voc", "a") as myfile:
                            myfile.write(
                                "#SERVICE 4097:0:1:0:0:0:0:0:0:0:%s\n#DESCRIPTION %s, %s\n"
                                % (streamurl.replace(":", "%3a"),
                                   conference_name, schedule_name))
                            myfile.close()

            if 'c3voc' not in open('/etc/enigma2/bouquets.tv').read():
                with open("/etc/enigma2/bouquets.tv", "a") as myfile:
                    myfile.write(
                        "#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET \"userbouquet.c3voc__tv_.tv\" ORDER BY bouquet"
                    )
                    myfile.close()

            shutil.move("/tmp/c3voc", "/etc/enigma2/userbouquet.c3voc__tv_.tv")
            eDVBDB.getInstance().reloadBouquets()
            self.session.open(MessageBox,
                              text=_("c3voc stream bouquet updated"),
                              type=MessageBox.TYPE_INFO,
                              timeout=4)
        except:
            pass

        self.close()
Ejemplo n.º 48
0
 def reloadBouquets(self):
     db = eDVBDB.getInstance()
     db.reloadServicelist()
     db.reloadBouquets()
Ejemplo n.º 49
0
 def alternativeNumberModeChange(configElement):
     eDVBDB.getInstance().setNumberingMode(configElement.value)
     refreshServiceList()
Ejemplo n.º 50
0
    def ipkgCallback(self, event, param):
        if event == IpkgComponent.EVENT_DOWNLOAD:
            self.status.setText(_("Downloading"))
        elif event == IpkgComponent.EVENT_UPGRADE:
            if self.sliderPackages.has_key(param):
                self.slider.setValue(self.sliderPackages[param])
            self.package.setText(param)
            self.status.setText(
                _("Upgrading") + ": %s/%s" %
                (self.packages, self.total_packages))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_INSTALL:
            self.package.setText(param)
            self.status.setText(_("Installing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_REMOVE:
            self.package.setText(param)
            self.status.setText(_("Removing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_CONFIGURING:
            self.package.setText(param)
            self.status.setText(_("Configuring"))

        elif event == IpkgComponent.EVENT_MODIFIED:
            if config.plugins.softwaremanager.overwriteConfigFiles.getValue(
            ) in ("N", "Y"):
                self.ipkg.write(True and config.plugins.softwaremanager.
                                overwriteConfigFiles.getValue())
            else:
                self.session.openWithCallback(
                    self.modificationCallback, MessageBox,
                    _("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?"
                      ) % (param))
        elif event == IpkgComponent.EVENT_ERROR:
            self.error += 1
        elif event == IpkgComponent.EVENT_DONE:
            if self.updating:
                self.updating = False
                self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
            elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
                from urllib import urlopen
                import socket
                currentTimeoutDefault = socket.getdefaulttimeout()
                socket.setdefaulttimeout(3)
                try:
                    config.softwareupdate.updateisunstable.setValue(
                        urlopen(
                            "http://enigma2.world-of-satellite.com/feeds/" +
                            about.getImageVersionString() + "/status").read())
                except:
                    config.softwareupdate.updateisunstable.setValue(1)
                socket.setdefaulttimeout(currentTimeoutDefault)
                self.total_packages = None
                if config.softwareupdate.updateisunstable.getValue(
                ) == '1' and config.softwareupdate.updatebeta.getValue():
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _(
                        "The current update maybe unstable") + "\n" + _(
                            "Are you sure you want to update your STB_BOX?"
                        ) + "\n(" + (ngettext("%s updated package available",
                                              "%s updated packages available",
                                              self.total_packages) %
                                     self.total_packages) + ")"
                elif config.softwareupdate.updateisunstable.getValue() == '0':
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _(
                        "Do you want to update your STB_BOX?") + "\n(" + (
                            ngettext("%s updated package available",
                                     "%s updated packages available",
                                     self.total_packages) %
                            self.total_packages) + ")"
                if self.total_packages:
                    config.softwareupdate.updatefound.setValue(True)
                    choices = [(_("View the changes"), "changes"),
                               (_("Upgrade and reboot system"), "cold")]
                    if path.exists(
                            "/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/BackupManager.pyo"
                    ):
                        if not config.softwareupdate.autosettingsbackup.getValue(
                        ):
                            choices.append(
                                (_("Perform a setting backup,") + '\n\t' +
                                 _("making a backup before updating") +
                                 '\n\t' + _("is strongly advised."), "backup"))
                        if not config.softwareupdate.autoimagebackup.getValue(
                        ):
                            choices.append((_("Perform a full image backup"),
                                            "imagebackup"))
                    choices.append((_("Update channel list only"), "channels"))
                    choices.append((_("Cancel"), ""))
                    upgrademessage = self.session.openWithCallback(
                        self.startActualUpgrade,
                        ChoiceBox,
                        title=message,
                        list=choices,
                        skin_name="SoftwareUpdateChoices")
                    upgrademessage.setTitle(_('Software update'))
                else:
                    upgrademessage = self.session.openWithCallback(
                        self.close,
                        MessageBox,
                        _("Nothing to upgrade"),
                        type=MessageBox.TYPE_INFO,
                        timeout=10,
                        close_on_any_key=True)
                    upgrademessage.setTitle(_('Software update'))
            elif self.channellist_only > 0:
                if self.channellist_only == 1:
                    self.setEndMessage(
                        _("Could not find installed channel list."))
                elif self.channellist_only == 2:
                    self.slider.setValue(2)
                    self.ipkg.startCmd(IpkgComponent.CMD_REMOVE,
                                       {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 3:
                    self.slider.setValue(3)
                    self.ipkg.startCmd(IpkgComponent.CMD_INSTALL,
                                       {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 4:
                    self.showUpdateCompletedMessage()
                    eDVBDB.getInstance().reloadBouquets()
                    eDVBDB.getInstance().reloadServicelist()
            elif self.error == 0:
                self.showUpdateCompletedMessage()
            else:
                self.activityTimer.stop()
                self.activityslider.setValue(0)
                error = _(
                    "Your STB_BOX might be unusable now. Please consult the manual for further assistance before rebooting your STB_BOX."
                )
                if self.packages == 0:
                    error = _("No updates available. Please try again later.")
                if self.updating:
                    error = _(
                        "Your STB_BOX isn't connected to the internet properly. Please check it and try again."
                    )
                self.status.setText(_("Error") + " - " + error)
        elif event == IpkgComponent.EVENT_LISTITEM:
            if 'enigma2-plugin-settings-' in param[
                    0] and self.channellist_only > 0:
                self.channellist_name = param[0]
                self.channellist_only = 2
        #print event, "-", param
        pass
Ejemplo n.º 51
0
 def ipkgCallback(self, event, param):
     if event == IpkgComponent.EVENT_DOWNLOAD:
         self.status.setText(_("Downloading"))
         self.package.setText(param.rpartition("/")[2].rstrip("."))
     elif event == IpkgComponent.EVENT_UPGRADE:
         self.slider.setValue(100 * self.packages / self.total_packages)
         self.package.setText(param)
         self.status.setText(
             _("Upgrading") + ": %s/%s" %
             (self.packages, self.total_packages))
         if param not in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_INSTALL:
         self.package.setText(param)
         self.status.setText(_("Installing"))
         if param not in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_REMOVE:
         self.package.setText(param)
         self.status.setText(_("Removing"))
         if param not in self.processed_packages:
             self.processed_packages.append(param)
             self.packages += 1
     elif event == IpkgComponent.EVENT_CONFIGURING:
         self.package.setText(param)
         self.status.setText(_("Configuring"))
     elif event == IpkgComponent.EVENT_MODIFIED:
         self.ipkg.write(
             config.softwareupdate.overwriteConfigFiles.value and "Y"
             or "N")
     elif event == IpkgComponent.EVENT_ERROR:
         self.error += 1
         self.updating = False
     elif event == IpkgComponent.EVENT_DONE:
         if self.updating:
             self.updating = False
             self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
         elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
             self.total_packages = None
             self.total_packages = len(self.ipkg.getFetchedList())
             message = _("Do you want to update your %s %s?") % (
                 getMachineBrand(), getMachineName()) + "\n(" + (ngettext(
                     "%s updated package available",
                     "%s updated packages available",
                     self.total_packages) % self.total_packages) + ")"
             if self.total_packages:
                 config.softwareupdate.updatefound.setValue(True)
                 choices = [
                     (_("View the changes"), "showlist"),
                     (_("Back up current settings"), "backup"),
                     (_("Update and ask to reboot"), "hot"),
                     # (_("Upgrade and reboot system"), "cold")
                 ]
                 choices.append((_("Cancel"), ""))
                 if self.total_packages > 198:
                     message += "\n" + _(
                         "\nThis is a large update. Consider a full USB update instead.\n"
                     )
                 upgrademessage = self.session.openWithCallback(
                     self.startActualUpgrade,
                     ChoiceBox,
                     text=message,
                     list=choices)
                 upgrademessage.setTitle(_('Software update'))
             else:
                 self["actions"].setEnabled(True)
                 upgrademessage = self.session.openWithCallback(
                     self.close,
                     MessageBox,
                     _("Nothing to upgrade"),
                     type=MessageBox.TYPE_INFO,
                     timeout=10,
                     close_on_any_key=True)
                 upgrademessage.setTitle(_('Software update'))
         elif self.channellist_only > 0:
             if self.channellist_only == 1:
                 self.setEndMessage(
                     _("Could not find installed channel list."))
             elif self.channellist_only == 2:
                 self.slider.setValue(33)
                 self.ipkg.startCmd(IpkgComponent.CMD_REMOVE,
                                    {'package': self.channellist_name})
                 self.channellist_only += 1
             elif self.channellist_only == 3:
                 self.slider.setValue(66)
                 self.ipkg.startCmd(IpkgComponent.CMD_INSTALL,
                                    {'package': self.channellist_name})
                 self.channellist_only += 1
             elif self.channellist_only == 4:
                 self.showUpdateCompletedMessage()
                 eDVBDB.getInstance().reloadBouquets()
                 eDVBDB.getInstance().reloadServicelist()
         elif self.error == 0:
             self.showUpdateCompletedMessage()
         else:
             self.activityTimer.stop()
             self.activityslider.setValue(0)
             error = _(
                 "Errors were encountered during update.\nUSB update is recommended."
             )
             if self.packages == 0:
                 if self.error != 0:
                     error = _(
                         "Problem retrieving update list.\nIf this issue persists please check/report on forum"
                     )
                 else:
                     error = _(
                         "A background update check is in progress,\nplease wait a few minutes and try again."
                     )
             if self.updating:
                 error = _(
                     "Update failed. Your %s %s does not have a working Internet connection."
                 ) % (getMachineBrand(), getMachineName())
             self.status.setText(_("Error") + " - " + error)
             self["actions"].setEnabled(True)
     elif event == IpkgComponent.EVENT_LISTITEM:
         if 'enigma2-plugin-settings-' in param[
                 0] and self.channellist_only > 0:
             self.channellist_name = param[0]
             self.channellist_only = 2
     #print event, "-", param
     pass
Ejemplo n.º 52
0
from Components.ParentalControl import InitParentalControl
InitParentalControl()

profile("LOAD:Navigation")
from Navigation import Navigation

profile("LOAD:skin")
from skin import readSkin

profile("LOAD:Tools")
from Tools.Directories import InitFallbackFiles, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_SKIN
from Components.config import config, configfile, ConfigText, ConfigYesNo, ConfigInteger, NoSave
InitFallbackFiles()

profile("ReloadProfiles")
eDVBDB.getInstance().reloadBouquets()

config.misc.radiopic = ConfigText(
    default=resolveFilename(SCOPE_CURRENT_SKIN, "radio.mvi"))
config.misc.isNextRecordTimerAfterEventActionAuto = ConfigYesNo(default=False)
config.misc.useTransponderTime = ConfigYesNo(default=True)
config.misc.startCounter = ConfigInteger(default=0)  # number of e2 starts...
config.misc.standbyCounter = NoSave(
    ConfigInteger(default=0))  # number of standby

#demo code for use of standby enter leave callbacks
#def leaveStandby():
#	print "!!!!!!!!!!!!!!!!!leave standby"

#def standbyCountChanged(configElement):
#	print "!!!!!!!!!!!!!!!!!enter standby num", configElement.value