def __init__(self):
     printDBG('M3U8Downloader.__init__ ----------------------------------')
     BaseDownloader.__init__(self)
     
     self.wgetStatus   = self.WGET_STS.NONE
     # instance of E2 console
     self.console = eConsoleAppContainer()
     self.iptv_sys = None
     
     # M3U8 list updater
     self.M3U8Updater = eConsoleAppContainer()
     self.M3U8Updater_appClosed_conn   = eConnectCallback(self.M3U8Updater.appClosed, self._updateM3U8Finished)
     self.M3U8Updater_stdoutAvail_conn = eConnectCallback(self.M3U8Updater.stdoutAvail, self._updateM3U8DataAvail)
     
     self.M3U8ListData = ''
     self.M3U8UpdaterRefreshDelay = 0
     self.refreshDelay = M3U8Downloader.MIN_REFRESH_DELAY
     
     # get only last fragments from first list, to satisfy specified duration in seconds
     # -1 means, starts from beginning
     self.startLiveDuration = M3U8Downloader.LIVE_START_OFFSET 
     
     # 0 means, starts from beginning
     self.skipFirstSegFromList = 0
     
     self.addStampToUrl = False
     self.totalDuration = -1
     self.downloadDuration = 0
     self.fragmentDurationList = []
Exemplo n.º 2
0
	def stopGetNetworkList(self):
		if self.oldInterfaceState is not None:
			if self.oldInterfaceState is False:
				iNetwork.setAdapterAttribute(self.iface, "up", False)
				enigma.eConsoleAppContainer().execute("ifconfig %s down" % self.iface)
				self.oldInterfaceState = None
				self.iface = None
Exemplo n.º 3
0
    def __init__(self,session):
	self.session = session
	Screen.__init__(self,session)
	self.swaps=[]
        self.container = eConsoleAppContainer()
	print "[AutoSwap] checking for existing swaps ..."
	s=open("/proc/swaps")
	# ignore first line
	line=s.readline()
	line=s.readline()
	while line:
		sp=line.split()
		self.swaps.append(sp[0])
		line=s.readline()
	s.close()
	print "[AutoSwap] setting swappiness to %s ..." % config.plugins.autoswap.swappiness.value      
        command="echo %s > /proc/sys/vm/swappiness" % config.plugins.autoswap.swappiness.value
        os.system(command)                
	print "[AutoSwap] setting requests to %s ..." % config.plugins.autoswap.requests.value      
        command="echo %s > /sys/block/sda/queue/nr_requests" % config.plugins.autoswap.requests.value
        os.system(command)                
	print "[AutoSwap] checking for available swapfiles ..."
	for name in os.listdir("/media"):
		if not name.startswith("net"):
			sw="/media/%s/swapfile" % name
			if os.path.exists(sw):
				#check if already swapped
				swapped=False
				for swaps in self.swaps:
					if sw == swaps:
						swapped=True
				if not swapped:
					if config.plugins.autoswap.boot.value:
						if config.plugins.autoswap.ignorehdd.value and sw.startswith("/media/hdd"):
							print "[AutoSwap] %s swapfile will be ignored" % sw
							command="swapoff %s" % sw
                		                        self.container.execute(command)
							self.swaps.append(sw)
						else:
							print "[AutoSwap] %s swapfile will be swapped" % sw
							command="swapon %s" % sw
                		                        self.container.execute(command)
							self.swaps.append(sw)
					else:
						print "[AutoSwap] %s swapfile will not be swapped" % sw
						self.swaps.append(sw)
					
        self.container = eConsoleAppContainer()
	self.container.appClosed.append(self.sfdiskDone)
	command="sfdisk -l > %s 2>&1" % autoswap_sfdisk
	# why does this dumb container fail ...
#       self.container.execute(command)
	os.system(command)
        
        self.AutoSwapTimer = eTimer()                           
        self.AutoSwapTimer.stop()                                 
        self.AutoSwapTimer.callback.append(self.doAutoSwapCheck)
	self.AutoSwapTimer.start(autoswap_checktime*1000, True)
	# after os.system we have to do a handjob
	self.sfdiskDone(True)
Exemplo n.º 4
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.list = []
        self['list'] = List(self.list)
        self['conn'] = StaticText('')
        self['spaceused'] = ProgressBar()
        self.container = eConsoleAppContainer()
        self.container.appClosed.append(self.runFinished)
        self.containerExtra = eConsoleAppContainer()
        self.containerExtra.appClosed.append(self.runFinishedExtra)

        self.linkExtra = t.readExtraUrl()

        self.MenuList = [('CamEx',_('Cam Manager'),_('Select or install your favourite cam'),'icons/p_cam.png',fileExists('/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/plugin.pyo')),
         ('DownAdd',_('Download Addons'),_('Download addons plugins'),'icons/p_downloads.png',True),
#        ('DownExtra',_('Extra Addons'),_('Download extra addons plugins'),'icons/p_extra.png',fileExists('/etc/atemio_extra.url')),
         ('ManInstall',_('Manual Install'),_('Manual install ipk files'),'icons/p_manual.png',True),
         ('RemAddons',_('Remove Addons'),_('Remove installed extra addons plugin'),'icons/p_remove.png',True),
         ('MountManager',_('Mount Manager'),_('Mount or umount your device'),'icons/p_mount.png',True),         
#        ('SwapManager',_('Swap Manager'),_('Added or remove swap'),'icons/p_swap.png',True),         
         ('ScriptEx',_('Script Executer'),_('Execute script'),'icons/p_script.png', True),
#        ('BkSetting',_('Backup Atemio'),_('Backup setting and flash'),'icons/p_backup.png', True),
         ('aboutTeam',_('About Team'),_('Show info about Team'),'icons/p_about.png', True)]

        self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.KeyOk,
         'red': self.cancel,
         'back': self.cancel})
        self.onLayoutFinish.append(self.updateList)
        self.onShown.append(self.setWindowTitle)
Exemplo n.º 5
0
	def getNetworkList(self):
		if self.oldInterfaceState is None:
			self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
		if self.oldInterfaceState is False:
			if iNetwork.getAdapterAttribute(self.iface, "up") is False:
				iNetwork.setAdapterAttribute(self.iface, "up", True)
				enigma.eConsoleAppContainer().execute("ifconfig %s up" % self.iface)

		ifobj = Wireless(self.iface) # a Wireless NIC Object

		try:
			scanresults = ifobj.scan()
		except:
			scanresults = None
			print "[Wlan.py] No wireless networks could be found"
		aps = {}
		if scanresults is not None:
			(num_channels, frequencies) = ifobj.getChannelInfo()
			index = 1
			for result in scanresults:
				bssid = result.bssid

				if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
					encryption = False
				elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
					encryption = True
				else:
					encryption = None

				signal = str(result.quality.siglevel-0x100) + " dBm"
				quality = "%s/%s" % (result.quality.quality,ifobj.getQualityMax().quality)

				extra = []
				for element in result.custom:
					element = element.encode()
					extra.append( strip(self.asciify(element)) )
				for element in extra:
					if 'SignalStrength' in element:
						signal = element[element.index('SignalStrength')+15:element.index(',L')]
					if 'LinkQuality' in element:
						quality = element[element.index('LinkQuality')+12:len(element)]

				# noinspection PyProtectedMember
				aps[bssid] = {
					'active' : True,
					'bssid': result.bssid,
					'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
					'encrypted': encryption,
					'essid': strip(self.asciify(result.essid)),
					'iface': self.iface,
					'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]),
					'noise' : '',#result.quality.nlevel-0x100,
					'quality' : str(quality),
					'signal' : str(signal),
					'custom' : extra,
				}

				index += 1
		return aps
Exemplo n.º 6
0
	def checkOldInterfaceState(self):
		# disable up interface if it was originally down and config is unchanged.
		if self.originalInterfaceStateChanged is False:
			for interface in self.originalInterfaceState.keys():
				if interface == self.selectedInterface:
					if self.originalInterfaceState[interface]["up"] is False:
						if iNetwork.checkforInterface(interface) is True:
							enigma.eConsoleAppContainer().execute("ifconfig %s down" % interface)
Exemplo n.º 7
0
	def stopGetNetworkList(self):
		if self.oldInterfaceState is not None:
			if self.oldInterfaceState is False:
				iNetwork.setAdapterAttribute(self.iface, "up", False)
				system("ifconfig "+self.iface+" down")
				if existBcmWifi(self.iface):
					eConsoleAppContainer().execute("wl down")
				self.oldInterfaceState = None
				self.iface = None
Exemplo n.º 8
0
	def __init__(self, mediaplayer):
		self.playlist = mediaplayer.playlist
		self.mp = mediaplayer
		self.cddb_container = eConsoleAppContainer()
		self.cddb_output = ""
		self.cdtext_container = eConsoleAppContainer()
		self.cdtext_output = ""
		self.tracklisting = {}
		self.albuminfo = {}
Exemplo n.º 9
0
	def __init__(self, session, type):
		Screen.__init__(self, session)
		
		self.type = type
		
		self.container = eConsoleAppContainer()
		self.container.appClosed.append(self.runFinished)
		self.container.dataAvail.append(self.dataAvail)
		self.onLayoutFinish.append(self.startRun)
		self.onShown.append(self.setWindowTitle)
		
		self.list = []
		self["list"] = PluginList(self.list)
		self.pluginlist = []
		self.expanded = []
		self.installedplugins = []
		
		if self.type == self.DOWNLOAD:
			self["text"] = Label(_("Downloading plugin information. Please wait..."))
		elif self.type == self.REMOVE:
			self["text"] = Label(_("Getting plugin information. Please wait..."))
		
		self.run = 0

		self.remainingdata = ""

		self["actions"] = ActionMap(["WizardActions"], 
		{
			"ok": self.go,
			"back": self.close,
		})
Exemplo n.º 10
0
	def __init__(self, session, title = "Console", cmdlist = None, finishedCallback = None, closeOnSuccess = False):
		Screen.__init__(self, session)

		self.finishedCallback = finishedCallback
		self.closeOnSuccess = closeOnSuccess
		self.errorOcurred = False

		self["text"] = ScrollLabel("")
		self["summary_description"] = StaticText("")
		self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
		{
			"ok": self.cancel,
			"back": self.cancel,
			"up": self["text"].pageUp,
			"down": self["text"].pageDown
		}, -1)

		self.cmdlist = cmdlist
		self.newtitle = title

		self.onShown.append(self.updateTitle)

		self.container = eConsoleAppContainer()
		self.run = 0
		self.container.appClosed.append(self.runFinished)
		self.container.dataAvail.append(self.dataAvail)
		self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
	def __init__(self, session, updateurl, version):
		from Components.Slider import Slider

		self.session = session
		Screen.__init__(self, session)
		self.target = updateurl
		self.version = version
		self.file_name = "/tmp/%s" % self.target.split('/')[-1]
		self.fileSize = 5 * 1024
		self.downloadDone = False
		self.container = eConsoleAppContainer()
		self.appClosed_conn = None
		self.stdoutAvail_conn = None

		self['srlog'] = Label()

		self.status = Label(_("Preparing... Please wait"))
		self['status'] = self.status
		self.activityslider = Slider(0, 100)
		self['activityslider'] = self.activityslider
		self.activity = 0
		self.activityTimer = eTimer()
		if isDreamboxOS:
			self.activityTimerConnection = self.activityTimer.timeout.connect(self.doActivityTimer)
		else:
			self.activityTimer.callback.append(self.doActivityTimer)

		self.onLayoutFinish.append(self.__onLayoutFinished)
Exemplo n.º 12
0
 def __init__(self):
     self.container = eConsoleAppContainer()
     self.container.appClosed.append(self.runDone)
     self.container.dataAvail.append(self.collOutput)
     self.queue = []
     self.output = ""
     self.running = False
Exemplo n.º 13
0
	def keyOK(self):
		if self.keyLocked:
			return
		self.keyLocked = True
		self.rtmpConsole    = None
		self.beforeService  = None
		self.currentService = None
		self.playerStoped   = False
		self.serviceDoCommand = None

		streamInfo = self["streamlist"].getCurrent()[0][1]
		uriInfo    = streamInfo.get('uri')
		typeInfo   = streamInfo.get('type').split(':')

		protocol = typeInfo[0]
		url      = uriInfo.get('URL')
		if protocol == 'rtmp':
			self.layoutFinished()
			self.rtmpConsole = eConsoleAppContainer()
			self.rtmpConsole.dataAvail.append(self.cbDataAvail)
			self.rtmpConsole.appClosed.append(self.cbAppClosed)
			self.rtmpConsole.execute(self.makeCommand(uriInfo))
		elif protocol in ('rtsp', 'http', 'hls'):
			serviceType = typeInfo[1]
			bufferSize  = typeInfo[2]
			self.doStreamAction(url, serviceType, bufferSize)
Exemplo n.º 14
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.list = []
		self['list'] = ListboxE1(self.list)
		self["key_red"] = Label(_("Exit"))
		self["title"] = Label(_("System Information"))
		self.cccmaplugyn = self.gboxplugyn = ''
		self.getPlugins()
		self.infoMenuList = [
			('GboxInfo',_('Gbox Suite'),'icons/cams.png',self.gboxplugyn),
			('CInfo',_('CCcam Info'),'icons/cams.png',self.cccmaplugyn),
			('DInfo',_('Show Device Status'),'icons/space.png',True),
			('PInfo',_('Show Active Process'),'icons/process.png',True),
			('SInfo',_('Show Service Info'),'icons/service.png',True),
			('EInfo',_('Show Enigma Settings'),'icons/enigma.png',True),
			('About',_('Nemesis-PROJECT Firmware Info'),'icons/about.png',True)
			]
		c = eConsoleAppContainer()
		c.execute('df > /tmp/info_df.tmp && free > /tmp/info_mem.tmp')
		del c
		self['actions'] = ActionMap(['WizardActions','ColorActions'],
		{
			'ok': self.KeyOk,
			"red": self.close,
			'back': self.close
		})
		self.onLayoutFinish.append(self.updateList)
		self.onShown.append(self.setWindowTitle)
Exemplo n.º 15
0
 def __init__(self, session, type = 0, needupdate = True):
     Screen.__init__(self, session)
     self.type = type
     self.needupdate = needupdate
     self.container = eConsoleAppContainer()
     self.container.appClosed.append(self.runFinished)
     self.container.dataAvail.append(self.dataAvail)
     self.onLayoutFinish.append(self.startRun)
     self.setTitle(self.type == self.DOWNLOAD and _("Downloadable new plugins") or _("Remove plugins"))
     self.list = []
     self['list'] = PluginList(self.list)
     self.pluginlist = []
     self.expanded = []
     self.installedplugins = []
     self.plugins_changed = False
     self.reload_settings = False
     self.check_settings = False
     self.install_settings_name = ''
     self.remove_settings_name = ''
     self["text"] = Label(self.type == self.DOWNLOAD and _("Downloading plugin information. Please wait...") or _("Getting plugin information. Please wait..."))
     self.run = 0
     self.remainingdata = ''
     self['actions'] = ActionMap(['WizardActions'], {'ok': self.go,
      'back': self.requestClose})
     if os.path.isfile('/usr/bin/opkg'):
         self.ipkg = '/usr/bin/opkg'
         self.ipkg_install = self.ipkg + ' install -force-overwrite'
         self.ipkg_remove = self.ipkg + ' remove --autoremove'
     else:
         self.ipkg = 'ipkg'
         self.ipkg_install = 'ipkg install -force-defaults'
         self.ipkg_remove = self.ipkg + ' remove'
Exemplo n.º 16
0
	def __init__(self, session, title = "Console", cmdlist = None, finishedCallback = None, closeOnSuccess = False, showStartStopText=True, skin=None):
		Screen.__init__(self, session)

		self.finishedCallback = finishedCallback
		self.closeOnSuccess = closeOnSuccess
		self.showStartStopText = showStartStopText
		if skin:
			self.skinName = [skin, "Console"]

		self.errorOcurred = False

		self["text"] = ScrollLabel("")
		self["key_red"] = StaticText(_("Cancel"))
		self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
		{
			"ok": self.cancel,
			"back": self.cancel,
			"up": self["text"].pageUp,
			"down": self["text"].pageDown
		}, -1)

		self.cmdlist = isinstance(cmdlist, list) and cmdlist or [cmdlist]
		self.newtitle = title == "Console" and _("Console") or title

		self.onShown.append(self.updateTitle)

		self.container = eConsoleAppContainer()
		self.run = 0
		self.container.appClosed.append(self.runFinished)
		self.container.dataAvail.append(self.dataAvail)
		self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
    def start(self, url, filePath, params = {}, info_from=None, retries=0):
        '''
            Owervrite start from BaseDownloader
        '''
        self.url              = url
        self.filePath         = filePath
        self.downloaderParams = params
        self.fileExtension    = '' # should be implemented in future
        
        self.outData = ''
        self.contentType = 'unknown'
        if None == info_from:
            info_from = WgetDownloader.INFO.FROM_FILE
        self.infoFrom    = info_from
        
        cmd = 'wget ' + '"' + self.url + '" -O "' + self.filePath + '" > /dev/null'
        printDBG("Download cmd[%s]" % cmd)
        
        self.console = eConsoleAppContainer()
        self.console_appClosed_conn = eConnectCallback(self.console.appClosed, self._cmdFinished)
        self.console.execute( cmd )

        self.wgetStatus = self.WGET_STS.CONNECTING
        self.status     = DMHelper.STS.DOWNLOADING
        
        self.onStart()
        return BaseDownloader.CODE_OK
Exemplo n.º 18
0
	def __init__(self, session, menulist):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Restore Plugins"))
		self.index = 0
		self.list = menulist
		for r in menulist:
			print "[SOFTWARE MANAGER] Plugin to restore: %s" % r[0]
		self.container = eConsoleAppContainer()
		self["menu"] = List(list())
		self["menu"].onSelectionChanged.append(self.selectionChanged)
		self["key_green"] = Button(_("Install"))
		self["key_red"] = Button(_("Cancel"))
		self["summary_description"] = StaticText("")
				
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
				{
					"red": self.exit,
					"green": self.green,
					"cancel": self.exit,
					"ok": self.ok
				}, -2)

		self["menu"].setList(menulist)
		self["menu"].setIndex(self.index)
		self.selectionChanged()
		self.onShown.append(self.setWindowTitle)
    def start(self, url, filePath, params = {}):
        '''
            Owervrite start from BaseDownloader
        '''
        self.url              = url
        self.filePath         = filePath
        self.downloaderParams = params
        self.fileExtension    = '' # should be implemented in future
        
        self.outData = ''
        self.contentType = 'unknown'
        
        cmd = "python " + DMHelper.GET_PWGET_PATH() + ' "' + self.url + '" "' + self.filePath + '" > /dev/null'
        printDBG("Download cmd[%s]" % cmd)
        
        self.console = eConsoleAppContainer()
        self.console_appClosed_conn = eConnectCallback(self.console.appClosed, self._cmdFinished)
        self.console_stderrAvail_conn = eConnectCallback(self.console.stderrAvail, self._dataAvail)

        self.console.execute( cmd )

        self.wgetStatus = self.WGET_STS.CONNECTING
        self.status     = DMHelper.STS.DOWNLOADING
        
        self.onStart()
        return BaseDownloader.CODE_OK
Exemplo n.º 20
0
 def removeLangClosed(self, status):
     print '[Language manager] status:%s' % status
     path = '/usr/share/enigma2/po/'
     folderpathfile = path + self.removelist[self.currentIndex] + '/LC_MESSAGES/enigma2.mo'
     foldermess = path + self.removelist[self.currentIndex] + '/LC_MESSAGES/'
     folderpath = path + self.removelist[self.currentIndex]
     if os_path.exists(folderpathfile):
         os_remove(folderpathfile)
     if os_path.exists(foldermess):
         removeDir(foldermess)
     if os_path.exists(folderpath):
         removeDir(folderpath)
     self.createMenu()
     self.currentIndex = self.currentIndex + 1
     if self.currentIndex < len(self.removelist):
         lang = self.removelist[self.currentIndex]
         if lang == 'pt_BR':
             lang = 'pt-br'
         cmd = 'opkg remove enigma2-language-' + lang
         self.container = eConsoleAppContainer()
         self.container.appClosed.append(self.removeLangClosed)
         self.container.execute(cmd)
     else:
         self.removelist = []
         self.removing = False
         self.createMenu()
Exemplo n.º 21
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self["progress"] = ProgressBar()
		self["progress"].setRange((0, 100))
		self["progress"].setValue(0)
		self["AboutScrollLabel"] = ScrollLabel("", showscrollbar=False)
		self["header"] = Label(_("Autoinstalling please wait for packages being updated"))

		self.logfile = open('/home/root/autoinstall.log', 'w')
		self.container = eConsoleAppContainer()
		self.container.appClosed.append(self.appClosed)
		self.container.dataAvail.append(self.dataAvail)
		self.counter = 0

		import glob
		autoinstallfiles = glob.glob('/media/*/backup/autoinstall%s' % open('/sys/class/net/eth0/address', 'r').readline().strip().replace(":", ""))
		autoinstallfiles.sort(key=os.path.getmtime, reverse=True)
		for autoinstallfile in autoinstallfiles:
			self.packages = [x.strip() for x in open(autoinstallfile).readlines()]
			if self.packages:
				self.totalpackages = len(self.packages)
				# make sure we have a valid package list before attempting to restore packages
				self.container.execute("opkg update")
				return
		self.abort()
Exemplo n.º 22
0
	def __init__(self, input):
	        self.Console = Console()
	        self.camstartcmd = ""
        	self.container = eConsoleAppContainer()
        	self.container.appClosed.append(self.finished)
        	self.actcam = config.NFRSoftcam.actcam.value
        	self.input = input
Exemplo n.º 23
0
    def __init__(self, session, title = "j00zekIPTVPlayerConsole", cmdlist = None, finishedCallback = None, closeOnSuccess = False):
        Screen.__init__(self, session)

        from enigma import eConsoleAppContainer
        from Components.ScrollLabel import ScrollLabel
        from Components.ActionMap import ActionMap
        from Plugins.Extensions.IPTVPlayer.components.iptvplayerinit import TranslateTXT as _
        
        self.finishedCallback = finishedCallback
        self.closeOnSuccess = closeOnSuccess
        self.errorOcurred = False

        self["text"] = ScrollLabel("")
        self["actions"] = ActionMap(["WizardActions", "DirectionActions"], 
        {
            "ok": self.cancel,
            "back": self.cancel,
            "up": self["text"].pageUp,
            "down": self["text"].pageDown
        }, -1)
        
        self.cmdlist = cmdlist
        self.newtitle = title
        
        self.onShown.append(self.updateTitle)
        
        self.container = eConsoleAppContainer()
        self.run = 0
        self.container.appClosed.append(self.runFinished)
        self.container.dataAvail.append(self.dataAvail)
        self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
Exemplo n.º 24
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self["AboutScrollLabel"] = ScrollLabel(_("Please wait"), showscrollbar=False)
		self.container = eConsoleAppContainer()
		self.container.appClosed.append(self.appClosed)
		self.container.dataAvail.append(self.dataAvail)
		self.onLayoutFinish.append(self.run_console)
 def start(self, uri, mode='loop'):
     self.uri = uri
     self.playMode = mode
     
     gstplayerPath = config.plugins.iptvplayer.gstplayerpath.value
     #'export GST_DEBUG="*:6" &&' + 
     cmd = gstplayerPath  + ' "%s"' % self.uri
     if "://" in self.uri: 
         cmd += ' "%s" "%s"  "%s"  "%s" ' % (self.gstAdditionalParams['download-buffer-path'], self.gstAdditionalParams['ring-buffer-max-size'], self.gstAdditionalParams['buffer-duration'], self.gstAdditionalParams['buffer-size'])
         tmp = strwithmeta(self.uri)
         url,httpParams = DMHelper.getDownloaderParamFromUrl(tmp)
         for key in httpParams: cmd += (' "%s=%s" ' % (key, httpParams[key]) )
         if 'http_proxy' in tmp.meta:
             tmp = tmp.meta['http_proxy']
             if '://' in tmp:
                 if '@' in tmp:
                     tmp = re.search('([^:]+?://)([^:]+?):([^@]+?)@(.+?)$', tmp)
                     if tmp: cmd += (' "proxy=%s" "proxy-id=%s" "proxy-pw=%s" ' % (tmp.group(1)+tmp.group(4), tmp.group(2), tmp.group(3)) )
                 else: cmd += (' "proxy=%s" ' % tmp)
     else:
         cmd = 'exteplayer3 "%s"' % self.uri + " > /dev/null"
     self.console = eConsoleAppContainer()
     self.console_appClosed_conn = eConnectCallback(self.console.appClosed, self._playerFinished)
     printDBG("IPTVSimpleAudioPlayer.start cmd[%s]" % cmd)
     self.console.execute( cmd )
     self.stopped = False
Exemplo n.º 26
0
	def StatusStartScanRound(self):
		parent = self.parent

		status = "Position: %s\nPolarisation: %s\nBand: %s\n" % \
				 (parent.PositionToString(parent.position), \
				  parent.PolarisationToString(parent.polarisation), \
				  parent.LOFToString(parent.lof))

		self["scan_state"].setText(status)

		parent.progress = (parent.polarisation + (parent.lof * 2)) * 25
		self["scan_progress"].setValue(parent.progress)

		parent.tuner.tune((parent.LOFToFreq(parent.lof), 0, parent.PolarisationToEnigma(parent.polarisation), 0, 0, parent.position, eDVBFrontendParametersSatellite.System_DVB_S, 0, 0, 0))

		cmdpre		= 'echo "wait (2 seconds)" && sleep 2 && echo start scanning && '
		cmdbinary	= self.parent.executable + ' %d %d %d %d %d %d %d %s' % (950, 2150, 2, 45, parent.polarisation, parent.lof, int(parent.select_nim.value), parent.i2cbus)
		cmdpost		= ' && echo finished'
		cmd			= ''

		if (parent.polarisation == parent.PolarisationFirst()) and (parent.lof == parent.LOFFirst()):
			cmd = cmdpre + cmd

		cmd = cmd + cmdbinary

		if (parent.polarisation == parent.PolarisationLast()) and (parent.lof == parent.LOFLast()):
			cmd = cmd + cmdpost

		print 'prepared command: "%s"' % (cmd)

		parent.app_container = eConsoleAppContainer()
		parent.app_container.appClosed.append(self.StatusAppContainerClose)
		parent.app_container.dataAvail.append(self.StatusAppContainerDataAvail)
		parent.app_container.execute(cmd)
Exemplo n.º 27
0
 def __init__(self, session, installNameList = [], removeNameList = [], installList = [], removeList = [], closetext = '', restart = False, autoclose = False):
     Screen.__init__(self, session)
     self.session = session
     self.installNameList = installNameList
     self.removeNameList = removeNameList
     self.installList = installList
     self.removeList = removeList
     self.autoclose = autoclose
     self.closetext = closetext
     self.restart = restart
     self.count_success = 0
     self.count_failed_remove = 0
     self.count_failed_install = 0
     self.count_removed = 0
     self.errormessage = ''
     self.cache = None
     self.downloader = None
     self.container = eConsoleAppContainer()
     self['activityslider'] = ProgressBar()
     self['activityslider'].setRange((0, 100))
     self['activityslider'].setValue(0)
     self['status'] = Label()
     self['package'] = Label()
     self['actions'] = ActionMap(['OkCancelActions'], {'ok': self.okClicked,
      'cancel': self.abort}, -1)
     self['status'].setText(_('Waiting to get resouces free...'))
     self.setTitle(_('Connecting') + '...')
     if os_path.exists(opkg_busy_filename):
         self.onCheckClose()
     else:
         self.onLayoutFinish.append(self.startDownload)
Exemplo n.º 28
0
	def __init__(self, session, service):
		Screen.__init__(self, session)
		
		self["infotext"] = StaticText(_("VPS-Plugin checks if the channel supports VPS ..."))
		
		self["actions"] = ActionMap(["OkCancelActions"], 
			{
				"cancel": self.finish,
			}, -1)
		
		if service is None or service.getPath():
			self.close()
			return

		self.service = service
		self.program = eConsoleAppContainer()
		self.program.dataAvail.append(self.program_dataAvail)
		self.program.appClosed.append(self.program_closed)
		self.check = eTimer()
		self.check.callback.append(self.doCheck)
		self.simulate_recordService = None
		self.last_serviceref = None
		self.calledfinished = False
		
		self.has_pdc, self.last_check, self.default_vps = Check_PDC.check_service(self.service)
		
		self.check.start(50, True)
Exemplo n.º 29
0
	def __init__(self, request, session):
		self.request = request

		mode = None
		graboptions = [GRAB_PATH, '-q', '-s']

		if "format" in request.args:
			fileformat = request.args["format"][0]
		else:
			fileformat = "jpg"
		if fileformat == "jpg":
			graboptions.append("-j")
			graboptions.append("95")
		elif fileformat == "png":
			graboptions.append("-p")
		elif fileformat != "bmp":
			fileformat = "bmp"

		if "r" in request.args:
			size = request.args["r"][0]
			graboptions.append("-r")
			graboptions.append("%d" % int(size))

		if "mode" in request.args:
			mode = request.args["mode"][0]
			if mode == "osd":
				graboptions.append("-o")
			elif mode == "video":
				graboptions.append("-v")
			elif mode == "pip":
				graboptions.append("-v")
				if InfoBar.instance.session.pipshown:
					graboptions.append("-i 1")
			elif mode == "lcd":
				eDBoxLCD.getInstance().dumpLCD()
				fileformat = "png"
				command = "cat /tmp/lcdshot.%s" % fileformat

		self.container = eConsoleAppContainer()
		self.container.appClosed.append(self.grabFinished)
		self.container.stdoutAvail.append(request.write)
		self.container.setBufferSize(32768)
		if mode == "lcd":
			if self.container.execute(command):
				raise Exception, "failed to execute: ", command
			sref = 'lcdshot'
		else:
			self.container.execute(GRAB_PATH, *graboptions)
			try:
				if mode == "pip" and InfoBar.instance.session.pipshown:
					ref = InfoBar.instance.session.pip.getCurrentService().toString()
				else:
					ref = session.nav.getCurrentlyPlayingServiceReference().toString()
				sref = '_'.join(ref.split(':', 10)[:10])
			except:  # noqa: E722
				sref = 'screenshot'
		sref = sref + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
		request.notifyFinish().addErrback(self.requestAborted)
		request.setHeader('Content-Disposition', 'inline; filename=%s.%s;' % (sref, fileformat))
		request.setHeader('Content-Type', 'image/%s' % fileformat.replace("jpg", "jpeg"))
Exemplo n.º 30
0
Arquivo: Task.py Projeto: popazerty/12
	def run(self, callback):
		failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False)
		if len(failed_preconditions):
			callback(self, failed_preconditions)
			return
		self.prepare()

		self.callback = callback
		from enigma import eConsoleAppContainer
		self.container = eConsoleAppContainer()
		self.appClosed_conn = self.container.appClosed.connect(self.processFinished)
		self.stdoutAvail_conn = self.container.stdoutAvail.connect(self.processStdout)
		self.stderrAvail_conn = self.container.stderrAvail.connect(self.processStderr)

		if self.cwd is not None:
			self.container.setCWD(self.cwd)

		if not self.cmd and self.cmdline:
			print "execute:", self.container.execute(self.cmdline), self.cmdline
		else:
			assert self.cmd is not None
			assert len(self.args) >= 1
			print "execute:", self.container.execute(self.cmd, *self.args), ' '.join(self.args)
		if self.initial_input:
			self.writeInput(self.initial_input)
Exemplo n.º 31
0
 def command(self, cmd):
     if path.exists(self.link):
         cmd = "%s %s" % (self.link, cmd)
         print("[CamControl][command]Executing %s" % cmd)
         eConsoleAppContainer().execute(cmd)
Exemplo n.º 32
0
    def __init__(self, session, menu_path="", type=0, needupdate=True):
        Screen.__init__(self, session)
        self.menu_path = menu_path
        self.type = type
        self.needupdate = needupdate

        self["menu_path_compressed"] = StaticText("")
        if self.type == self.DOWNLOAD:
            screentitle = _("Install plugins")
            if config.usage.show_menupath.value == 'large':
                self.menu_path += screentitle
                title = self.menu_path
                self["menu_path_compressed"].setText("")
            elif config.usage.show_menupath.value == 'small':
                title = screentitle
                self["menu_path_compressed"].setText(
                    self.menu_path + " >" if not self.menu_path.endswith(' / ')
                    else self.menu_path[:-3] + " >" or "")
            else:
                title = screentitle
                self["menu_path_compressed"].setText("")
        elif self.type == self.REMOVE:
            screentitle = _("Remove plugins")
            if config.usage.show_menupath.value == 'large':
                self.menu_path += screentitle
                title = self.menu_path
                self["menu_path_compressed"].setText("")
            elif config.usage.show_menupath.value == 'small':
                title = screentitle
                self["menu_path_compressed"].setText(
                    self.menu_path + " >" if not self.menu_path.endswith(' / ')
                    else self.menu_path[:-3] + " >" or "")
            else:
                title = screentitle
                self["menu_path_compressed"].setText("")
        self.setTitle(title)

        self.container = eConsoleAppContainer()
        self.container.appClosed.append(self.runFinished)
        self.container.dataAvail.append(self.dataAvail)
        self.onLayoutFinish.append(self.startRun)

        self.list = []
        self["list"] = PluginList(self.list)
        self.pluginlist = []
        self.expanded = []
        self.installedplugins = []
        self.plugins_changed = False
        self.reload_settings = False
        self.check_settings = False
        self.check_bootlogo = False
        self.install_settings_name = ''
        self.remove_settings_name = ''

        if self.type == self.DOWNLOAD:
            self["text"] = Label(
                _("Downloading plugin information. Please wait..."))
        elif self.type == self.REMOVE:
            self["text"] = Label(
                _("Getting plugin information. Please wait..."))

        self.run = 0
        self.remainingdata = ""
        self["actions"] = ActionMap(["WizardActions"], {
            "ok": self.go,
            "back": self.requestClose,
        })
        if os.path.isfile('/usr/bin/opkg'):
            self.ipkg = '/usr/bin/opkg'
            self.ipkg_install = self.ipkg + ' install'
            self.ipkg_remove = self.ipkg + ' remove --autoremove'
        else:
            self.ipkg = 'ipkg'
            self.ipkg_install = 'ipkg install -force-defaults'
            self.ipkg_remove = self.ipkg + ' remove'
Exemplo n.º 33
0
    def __init__(self, session, iface, plugin_path):
        self.skin = setupSamba.skin
        self.session = session
        Screen.__init__(self, session)

        self.container = eConsoleAppContainer()
        self.container.appClosed.append(self.runFinished)
        self.container.dataAvail.append(self.dataAvail)

        if isRunning('smbd') and isRunning('nmbd'):
            isEnabled = True
        else:
            isEnabled = False

        confError = False
        tmp = getAttribute('/etc/samba/smb.conf', 'global', 'server string')
        if tmp is not None:
            serverString = tmp
        else:
            serverString = 'READERROR server string'
            confError = True

        tmp = getAttribute('/etc/samba/smb.conf', 'global', 'netbios name')
        if tmp is not None:
            netbiosName = tmp
        else:
            netbiosName = 'READERROR netbios name'
            confError = True

        tmp = getAttribute('/etc/samba/smb.conf', 'global', 'workgroup')
        if tmp is not None:
            workgroup = tmp
        else:
            workgroup = 'READERROR workgroup'
            confError = True

        self.activeConfigEntry = NoSave(ConfigEnableDisable(default=isEnabled))
        self.serverStringConfigEntry = NoSave(
            ConfigText(default=serverString,
                       visible_width=50,
                       fixed_size=False))
        self.netbiosNameConfigEntry = NoSave(
            ConfigText(default=netbiosName, visible_width=50,
                       fixed_size=False))
        self.workgroupConfigEntry = NoSave(
            ConfigText(default=workgroup, visible_width=50, fixed_size=False))

        self["smbdLabel"] = Label()
        self["nmbdLabel"] = Label()
        self["ButtonGreen"] = Pixmap()
        self["ButtonGreentext"] = Button(
            _("save and start/restart Samba-Server"))
        self["ButtonRed"] = Pixmap()
        self["ButtonRedtext"] = Label(_("Close"))

        self.startingUp = False
        self.goingDown = False
        self.cmdlist = []
        self.run = 0

        self.createSetup()
        ConfigListScreen.__init__(self, self.list, session=session)
        self.activeConfigEntry.addNotifier(self.toggleServer)

        self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {
            "cancel": self.cancel,
            "red": self.cancel,
            "green": self.green
        }, -2)

        if confError:
            self.onExecBegin.append(self.errorMbox)
Exemplo n.º 34
0
 def clearMemory(self):
     eConsoleAppContainer().execute("sync")
     open("/proc/sys/vm/drop_caches", "w").write("3")
     self.getMemoryInfo()
	def __init__(self, ipkg = 'opkg'):
		self.ipkg = ipkg
		self.cmd = eConsoleAppContainer()
		self.cache = None
		self.callbackList = []
		self.setCurrentCommand()
Exemplo n.º 36
0
 def execHotkey(self, selected):
     if selected:
         selected = selected[1].split("/")
         if selected[0] == "Plugins":
             twinPlugins = []
             twinPaths = {}
             pluginlist = plugins.getPlugins(
                 PluginDescriptor.WHERE_EVENTINFO)
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames:
                     if plugin.path[24:] in twinPaths:
                         twinPaths[plugin.path[24:]] += 1
                     else:
                         twinPaths[plugin.path[24:]] = 1
                     if plugin.path[24:] + "/" + str(twinPaths[
                             plugin.path[24:]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
             pluginlist = plugins.getPlugins([
                 PluginDescriptor.WHERE_PLUGINMENU,
                 PluginDescriptor.WHERE_EXTENSIONSMENU
             ])
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path:
                     if plugin.path[24:] in twinPaths:
                         twinPaths[plugin.path[24:]] += 1
                     else:
                         twinPaths[plugin.path[24:]] = 1
                     if plugin.path[24:] + "/" + str(twinPaths[
                             plugin.path[24:]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
         elif selected[0] == "MenuPlugin":
             for plugin in plugins.getPluginsForMenu(selected[1]):
                 if plugin[2] == selected[2]:
                     self.runPlugin(plugin[1])
                     return
         elif selected[0] == "Infobar":
             if hasattr(self, selected[1]):
                 exec "self." + ".".join(selected[1:]) + "()"
             else:
                 return 0
         elif selected[0] == "Module":
             try:
                 exec "from " + selected[1] + " import *"
                 exec "self.session.open(" + ",".join(selected[2:]) + ")"
             except:
                 print "[Hotkey] error during executing module %s, screen %s" % (
                     selected[1], selected[2])
         elif selected[0] == "SoftcamSetup" and SystemInfo[
                 "HasSoftcamInstalled"]:
             from Screens.SoftcamSetup import SoftcamSetup
             self.session.open(SoftcamSetup)
         elif selected[0] == "Setup":
             from Screens.Setup import *
             exec "self.session.open(Setup, \"" + selected[1] + "\")"
         elif selected[0].startswith("Zap"):
             if selected[0] == "ZapPanic":
                 self.servicelist.history = []
                 self.pipShown() and self.showPiP()
             self.servicelist.servicelist.setCurrent(
                 eServiceReference("/".join(selected[1:])))
             self.servicelist.zap(enable_pipzap=True)
             if hasattr(self, "lastservice"):
                 self.lastservice = eServiceReference("/".join(
                     selected[1:]))
                 self.close()
             else:
                 self.show()
             from Screens.MovieSelection import defaultMoviePath
             moviepath = defaultMoviePath()
             if moviepath:
                 config.movielist.last_videodir.value = moviepath
         elif selected[0] == "PPanel":
             ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml"
             if os.path.isfile(ppanelFileName) and os.path.isdir(
                     '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'):
                 from Plugins.Extensions.PPanel.ppanel import PPanel
                 self.session.open(PPanel,
                                   name=selected[1] + ' PPanel',
                                   node=None,
                                   filename=ppanelFileName,
                                   deletenode=None)
         elif selected[0] == "Shellscript":
             command = '/usr/script/' + selected[1] + ".sh"
             if os.path.isfile(command):
                 if ".hidden." in command:
                     from enigma import eConsoleAppContainer
                     eConsoleAppContainer().execute(command)
                 else:
                     from Screens.Console import Console
                     self.session.open(
                         Console,
                         selected[1] + " shellscript",
                         command,
                         closeOnSuccess=selected[1].startswith('!'),
                         showStartStopText=False)
         elif selected[0] == "Menu":
             from Screens.Menu import MainMenu, mdom
             root = mdom.getroot()
             for x in root.findall("menu"):
                 y = x.find("id")
                 if y is not None:
                     id = y.get("val")
                     if id and id == selected[1]:
                         menu_screen = self.session.open(MainMenu, x)
                         break
Exemplo n.º 37
0
    def start(self, url, filePath, params={}):
        '''
            Owervrite start from BaseDownloader
        '''
        self.url = url
        self.filePath = filePath
        self.downloaderParams = params
        self.fileExtension = ''  # should be implemented in future
        self.outData = ''
        self.contentType = 'unknown'

        cmdTab = [DMHelper.GET_FFMPEG_PATH(), '-y']
        tmpUri = strwithmeta(url)

        if 'iptv_video_rep_idx' in tmpUri.meta:
            cmdTab.extend(
                ['-video_rep_index',
                 str(tmpUri.meta['iptv_video_rep_idx'])])

        if 'iptv_audio_rep_idx' in tmpUri.meta:
            cmdTab.extend(
                ['-audio_rep_index',
                 str(tmpUri.meta['iptv_audio_rep_idx'])])

        if 'iptv_m3u8_live_start_index' in tmpUri.meta:
            cmdTab.extend([
                '-live_start_index',
                str(tmpUri.meta['iptv_m3u8_live_start_index'])
            ])

        if 'iptv_m3u8_key_uri_replace_old' in tmpUri.meta and 'iptv_m3u8_key_uri_replace_new' in tmpUri.meta:
            cmdTab.extend([
                '-key_uri_old',
                str(tmpUri.meta['iptv_m3u8_key_uri_replace_old']),
                '-key_uri_new',
                str(tmpUri.meta['iptv_m3u8_key_uri_replace_new'])
            ])

        if "://" in self.url:
            url, httpParams = DMHelper.getDownloaderParamFromUrlWithMeta(
                tmpUri, True)
            headers = []
            for key in httpParams:
                if key == 'Range':  #Range is always used by ffmpeg
                    continue
                elif key == 'User-Agent':
                    cmdTab.extend(['-user-agent', httpParams[key]])
                else:
                    headers.append('%s: %s' % (key, httpParams[key]))

            if len(headers):
                cmdTab.extend(['-headers', '\r\n'.join(headers)])

        if self.url.startswith("merge://"):
            try:
                urlsKeys = self.url.split('merge://', 1)[1].split('|')
                for item in urlsKeys:
                    cmdTab.extend(
                        ['-reconnect', '1', '-i', self.url.meta[item]])
            except Exception:
                printExc()
        else:
            cmdTab.extend(['-reconnect', '1', '-i', url])

        cmdTab.extend([
            '-c:v', 'copy', '-c:a', 'copy', '-f',
            tmpUri.meta.get('ff_out_container', self.ffmpegOutputContener),
            self.filePath
        ])

        self.fileCmdPath = self.filePath + '.iptv.cmd'
        rm(self.fileCmdPath)
        WriteTextFile(self.fileCmdPath, '|'.join(cmdTab))

        cmd = GetCmdwrapPath() + (' "%s" "|" %s ' %
                                  (self.fileCmdPath, GetNice() + 2))

        printDBG("FFMPEGDownloader::start cmd[%s]" % cmd)

        self.console = eConsoleAppContainer()
        self.console_appClosed_conn = eConnectCallback(self.console.appClosed,
                                                       self._cmdFinished)
        self.console_stderrAvail_conn = eConnectCallback(
            self.console.stderrAvail, self._dataAvail)
        self.console.execute(cmd)

        self.status = DMHelper.STS.DOWNLOADING

        self.onStart()
        return BaseDownloader.CODE_OK
Exemplo n.º 38
0
 def __init__(self, session, path=""):
     resource.Resource.__init__(self)
     self.session = session
     self.container = eConsoleAppContainer()
     self.container.appClosed.append(self.grabFinished)
Exemplo n.º 39
0
	def prombt(self, com):
		container = eConsoleAppContainer()
		container.execute(com)			
		self.close(True)
Exemplo n.º 40
0
    def getNetworkList(self):
        if self.oldInterfaceState is None:
            self.oldInterfaceState = iNetwork.getAdapterAttribute(
                self.iface, "up")
        if self.oldInterfaceState is False:
            if iNetwork.getAdapterAttribute(self.iface, "up") is False:
                iNetwork.setAdapterAttribute(self.iface, "up", True)
                enigma.eConsoleAppContainer().execute("ifconfig %s up" %
                                                      self.iface)
                if existBcmWifi(self.iface):
                    enigma.eConsoleAppContainer().execute("wl up")

        ifobj = Wireless(self.iface)  # a Wireless NIC Object

        try:
            scanresults = ifobj.scan()
        except:
            scanresults = None
            print "[Wlan.py] No wireless networks could be found"
        aps = {}
        if scanresults is not None:
            (num_channels, frequencies) = ifobj.getChannelInfo()
            index = 1
            for result in scanresults:
                bssid = result.bssid

                # skip hidden networks
                if not result.essid:
                    continue

                if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
                    encryption = False
                elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
                    encryption = True
                else:
                    encryption = None

                signal = str(result.quality.siglevel - 0x100) + " dBm"
                quality = "%s/%s" % (result.quality.quality,
                                     ifobj.getQualityMax().quality)

                extra = []
                for element in result.custom:
                    element = element.encode()
                    extra.append(strip(self.asciify(element)))
                for element in extra:
                    if 'SignalStrength' in element:
                        signal = element[element.index('SignalStrength') +
                                         15:element.index(',L')]
                    if 'LinkQuality' in element:
                        quality = element[element.index('LinkQuality') +
                                          12:len(element)]

                channel = "Unknown"
                try:
                    channel = frequencies.index(
                        ifobj._formatFrequency(
                            result.frequency.getFrequency())) + 1
                except:
                    channel = "Unknown"

                aps[bssid] = {
                    'active': True,
                    'bssid': result.bssid,
                    'channel': channel,
                    'encrypted': encryption,
                    'essid': strip(self.asciify(result.essid)),
                    'iface': self.iface,
                    'maxrate': ifobj._formatBitrate(result.rate[-1][-1]),
                    'noise': '',  #result.quality.nlevel-0x100,
                    'quality': str(quality),
                    'signal': str(signal),
                    'custom': extra,
                }

                index = index + 1
        return aps
Exemplo n.º 41
0
 def __init__(self,
              session,
              category_id='%',
              category_name='Packages',
              updates='0',
              limit=''):
     global global_executer
     self.limit = limit
     self.onlyShowUpdates = updates
     self['title'] = Label(_('OpenStore // ' + category_name))
     self.orderby = '&orderby=date_created%20desc%20' + limit
     self.url = 'http://connect.mymetrix.de/store/api/?q=get.xml.packages'
     self.screenshotpath = 'http://connect.mymetrix.de/store/api/?q=get.pngresized&width=550'
     self.downloadurl = 'http://connect.mymetrix.de/store/api/?q=get.xml.packagefile'
     Screen.__init__(self, session)
     global_executer = eConsoleAppContainer()
     self.session = session
     self['itemname'] = Label()
     self['author'] = Label()
     self['votes'] = Label()
     self['date'] = Label()
     self['sort'] = Label(_('New'))
     self['description'] = Label()
     self['isInstalled'] = Label()
     self.category_id = category_id
     self.currentid = '0'
     self.image_id = ''
     self.image_token = ''
     self.file_id = ''
     self.file_token = ''
     self.currentgroup = 'Packages'
     self.picPath = ''
     self.Scale = AVSwitch().getFramebufferScale()
     self.PicLoad = ePicLoad()
     self['helperimage'] = Pixmap()
     self.getCatalog = True
     self.getEntry = True
     self.initPicture = True
     self.action_downloadPackage = False
     self['menu'] = PackagesList([])
     self.menulist = []
     self.menulist.append(
         self.PackagesListEntry('-', _('loading, please wait...'), '', '0',
                                '0', '0', '0', '0', '0', '0', '', '', ''))
     self['menu'].setList(self.menulist)
     self['actions'] = ActionMap(
         [
             'OkCancelActions', 'DirectionActions', 'InputActions',
             'ColorActions'
         ], {
             'up': self.keyUp,
             'ok': self.selectItem,
             'green': self.installPackage,
             'blue': self.changeSort,
             'down': self.keyDown,
             'right': self.pageDown,
             'left': self.pageUp,
             'yellow': self.openRating,
             'cancel': self.save
         }, -1)
     self.onLayoutFinish.append(self.startThread)
Exemplo n.º 42
0
	def command(self, cmd):
		if os.path.exists(self.link):
			print("[camcontrol] Executing", self.link + ' ' + cmd)
			enigma.eConsoleAppContainer().execute(self.link + ' ' + cmd)
Exemplo n.º 43
0
def Disabled(session, **kwargs):
    container = eConsoleAppContainer()
    container.execute('/etc/init.d/boblight-control stop')
Exemplo n.º 44
0
def runScreenTest():
    config.misc.startCounter.value += 1

    profile("readPluginList")
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value,
                     config.misc.isNextPowerTimerAfterEventActionAuto.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    profile("wizards")
    screensToRun = []
    RestoreSettings = None
    if os.path.exists("/media/hdd/images/config/settings"
                      ) and config.misc.firstrun.value:
        if autorestoreLoop():
            RestoreSettings = True
            from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen
            session.open(RestoreScreen, runRestore=True)
        else:
            screensToRun = [
                p.__call__
                for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
            ]
            screensToRun += wizardManager.getWizards()
    else:
        if os.path.exists("/media/hdd/images/config/autorestore"):
            os.system('rm -f /media/hdd/images/config/autorestore')
        screensToRun = [
            p.__call__
            for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
        ]
        screensToRun += wizardManager.getWizards()

    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()
    print screensToRun

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            print "[mytest.py] quitMainloop #3"
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]
        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    if not RestoreSettings:
        runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    if boxtype in ('mixosf5', 'mixosf7', 'mixoslumi', 'gi9196m', 'maram9',
                   'ixussone', 'ixussone', 'uniboxhd1', 'uniboxhd2',
                   'uniboxhd3', 'sezam5000hd', 'mbtwin', 'sezam1000hd',
                   'mbmini', 'atemio5x00', 'beyonwizt3'):
        profile("VFDSYMBOLS")
        import Components.VfdSymbols
        Components.VfdSymbols.SymbolsCheck(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()

    if boxtype in ('gb800se', 'gb800solo', 'gb800seplus'):
        from enigma import evfd, eConsoleAppContainer
        try:
            cmd = 'vfdctl "    openatv starting e2"'
            container = eConsoleAppContainer()
            container.execute(cmd)
        except:
            evfd.getInstance().vfd_write_string("-E2-")
        evfd.getInstance().vfd_led(str(1))

    if boxtype in ('sf8', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius',
                   'evo'):
        f = open("/dev/dbox/oled0", "w")
        f.write('-E2-')
        f.close()

    print "lastshutdown=%s		(True = last shutdown was OK)" % config.usage.shutdownOK.value
    print "NOK shutdown action=%s" % config.usage.shutdownNOK_action.value
    print "bootup action=%s" % config.usage.boot_action.value
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal' or not config.usage.boot_action.value == 'normal':
        print "last shutdown = %s" % config.usage.shutdownOK.value
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)

    config.usage.shutdownOK.setValue(False)
    config.usage.shutdownOK.save()
    if not RestoreSettings:
        configfile.save()

    runReactor()

    print "[mytest.py] normal shutdown"
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()

    profile("wakeup")

    #get currentTime
    nowTime = time()
    if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith(
            'gb') or getBrandOEM().startswith('ini'):
        print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
            "%Y/%m/%d %H:%M", localtime(nowTime))
        setRTCtime(nowTime)

    wakeupList = [
        x for x in (
            (session.nav.RecordTimer.getNextRecordingTime(), 0,
             session.nav.RecordTimer.isNextRecordAfterEventActionAuto()),
            (session.nav.RecordTimer.getNextZapTime(),
             1), (plugins.getNextWakeupTime(), 2),
            (session.nav.PowerTimer.getNextPowerManagerTime(), 3,
             session.nav.PowerTimer.isNextPowerManagerAfterEventActionAuto()))
        if x[0] != -1
    ]
    wakeupList.sort()
    recordTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] != 3:
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 270:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            if boxtype.startswith("gb"):
                wptime = startTime[
                    0] - 120  # Gigaboxes already starts 2 min. before wakeup time
            else:
                wptime = startTime[0] - 240
#		if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith('gb'):
#			print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime))
#			setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime))
        setFPWakeuptime(wptime)
        recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
        print 'recordTimerWakeupAuto', recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.save()

    PowerTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] == 3:
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 60:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            if config.workaround.deeprecord.value:
                wptime = startTime[
                    0] - 240  # Gigaboxes already starts 2 min. before wakeup time
            else:
                wptime = startTime[0]


#		if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
#			print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime))
#			setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime + 60))
        setFPWakeuptime(wptime)
        PowerTimerWakeupAuto = startTime[1] == 3 and startTime[2]
        print 'PowerTimerWakeupAuto', PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.value = PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.save()

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
Exemplo n.º 45
0
    def __init__(self, session, args=None):
        Screen.__init__(self, session)
        InfoBarAudioSelection.__init__(self)
        InfoBarCueSheetSupport.__init__(self,
                                        actionmap="DivXPlayerCueSheetActions")
        InfoBarNotifications.__init__(self)
        InfoBarBase.__init__(self)
        InfoBarSubtitleSupport.__init__(self)
        HelpableScreen.__init__(self)

        self.container = eConsoleAppContainer()

        self.summary = None
        self.oldService = self.session.nav.getCurrentlyPlayingServiceReference(
        )
        self.session.nav.stopService()

        # 'None' is magic to start at the list of mountpoints
        self.filelist = FileList(
            None,
            matchingPattern="(?i)^.*\.(avi)",
            useServiceRef=True,
            additionalExtensions="4098:m3u 4098:e2pls 4098:pls")
        self["filelist"] = self.filelist

        self.is_closing = False
        self.delname = ""

        self.next_operation = ""
        self.lastServicePlayed = None
        self.current_service = None

        self["PositionGauge"] = ServicePositionGauge(self.session.nav)

        self["currenttext"] = Label("")

        self.repeat = False
        self.seek_target = None

        class DivXPlayerActionMap(NumberActionMap):
            def __init__(self, player, contexts=[], actions={}, prio=0):
                NumberActionMap.__init__(self, contexts, actions, prio)
                self.player = player

            def action(self, contexts, action):
                self.player.show()
                return NumberActionMap.action(self, contexts, action)

        self["OkCancelActions"] = HelpableActionMap(
            self, "OkCancelActions", {
                "ok": (self.ok, _("play divx file")),
                "cancel": (self.exit, _("exit divxplayer")),
            }, -2)

        self["DivXPlayerActions"] = HelpableActionMap(
            self, "DivXPlayerActions", {
                "play": (self.playEntry, _("play entry")),
                "pause": (self.pauseEntry, _("pause")),
                "stop": (self.stopEntry, _("stop entry")),
                "forward": (self.forwardEntry, _("forward entry")),
                "backward": (self.doNothing, _("backward entry")),
                "menu": (self.showMenu, _("menu")),
            }, -2)

        self["actions"] = DivXPlayerActionMap(
            self, ["DirectionActions"], {
                "right": self.right,
                "left": self.left,
                "up": self.up,
                "upRepeated": self.up,
                "upUp": self.doNothing,
                "down": self.down,
                "downRepeated": self.down,
                "downUp": self.doNothing,
            }, -2)

        InfoBarSeek.__init__(self, actionmap="DivXPlayerSeekActions")

        self.onClose.append(self.__onClose)

        self.__event_tracker = ServiceEventTracker(
            screen=self,
            eventmap={
                iPlayableService.evUser + 11: self.__evDecodeError,
                iPlayableService.evUser + 12: self.__evPluginError
            })
Exemplo n.º 46
0
	def __init__(self, request, session):
		self.request = request

		mode = None
		graboptions = [GRAB_PATH, '-q', '-s']

		if "format" in request.args:
			fileformat = request.args["format"][0]
		else:
			fileformat = "jpg"
		if fileformat == "jpg":
			graboptions.append("-j")
			graboptions.append("95")
		elif fileformat == "png":
			graboptions.append("-p")
		elif fileformat != "bmp":
			fileformat = "bmp"

		if "r" in request.args:
			size = request.args["r"][0]
			graboptions.append("-r")
			graboptions.append("%d" % int(size))

		if "mode" in request.args:
			mode = request.args["mode"][0]
			if mode == "osd":
				graboptions.append("-o")
			elif mode == "video":
				graboptions.append("-v")
			elif mode == "pip":
				graboptions.append("-v")
				if InfoBar.instance.session.pipshown:
					graboptions.append("-i 1")
			elif mode == "lcd":
				eDBoxLCD.getInstance().dumpLCD()
				fileformat = "png"
				command = "cat /tmp/lcdshot.%s" % fileformat

		self.container = eConsoleAppContainer()
		self.container.appClosed.append(self.grabFinished)
		self.container.stdoutAvail.append(request.write)
		self.container.setBufferSize(32768)
		if mode == "lcd":
			if self.container.execute(command):
				raise Exception, "failed to execute: ", command
			sref = 'lcdshot'
		else:
			self.container.execute(GRAB_PATH, *graboptions)
			try:
				if mode == "pip" and InfoBar.instance.session.pipshown:
					ref = InfoBar.instance.session.pip.getCurrentService().toString()
				else:
					ref = session.nav.getCurrentlyPlayingServiceReference().toString()
				sref = '_'.join(ref.split(':', 10)[:10])
			except:  # noqa: E722
				sref = 'screenshot'
		sref = sref + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
		request.notifyFinish().addErrback(self.requestAborted)
		request.setHeader('Content-Disposition', 'inline; filename=%s.%s;' % (sref, fileformat))
		request.setHeader('Content-Type', 'image/%s' % fileformat.replace("jpg", "jpeg"))
		request.setHeader('Expires', 'Sat, 26 Jul 1997 05:00:00 GMT')
		request.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0')
		request.setHeader('Pragma', 'no-cache')
Exemplo n.º 47
0
 def ColorRestart(self):
     self.save()
     self.container = eConsoleAppContainer()
     self.container.execute('/etc/init.d/boblight-control restart_moodlamp')
     self.session.open(MessageBox, _('Reload moodlamp settings...'), MessageBox.TYPE_INFO, timeout=2)
     self.createConfigList()
Exemplo n.º 48
0
    def doCheck(self):
        emuDir = "/etc/"
        self.emuList = []
        self.mlist = []
        self.emuDirlist = []
        self.emuBin = []
        self.emuStart = []
        self.emuStop = []
        self.emuDirlist = listdir(emuDir)
        cam_name = config.softcam.actCam.value
        cam_name2 = config.softcam.actCam2.value
        if (cam_name == "no CAM 1 active" or cam_name
                == "") and (cam_name2 == "no CAM 2 active" or cam_name2 == ""):
            print "[CAMSCHECK] No Cam to Check, Exit"
            global isBusy
            isBusy = None
            return

        for x in self.emuDirlist:
            #// if file contains the string "emu" (then this is a emu config file)
            if x.find("emu") > -1:
                self.emuList.append(emuDir + x)
                em = open(emuDir + x)
                #// read the emu config file
                for line in em.readlines():
                    line1 = line
                    #// emuname
                    if line.find("emuname") > -1:
                        line = line.split("=")
                        self.mlist.append(line[1].strip())
                    #// binname
                    line = line1
                    if line.find("binname") > -1:
                        line = line.split("=")
                        self.emuBin.append(line[1].strip())
                    #// startcam
                    line = line1
                    if line.find("startcam") > -1:
                        line = line.split("=")
                        self.emuStart.append(line[1].strip())
                    #// stopcam
                    line = line1
                    if line.find("stopcam") > -1:
                        line = line.split("=")
                        self.emuStop.append(line[1].strip())

                em.close()

        camrunning = 0
        camfound = 0
        camfrozen = 0
        indexcam = -1
        camrunning2 = 0
        camfound2 = 0
        camfrozen2 = 0
        indexcam2 = -1
        tel = 0

        for x in self.mlist:
            #print '[CAMSTARTER] searching active cam: ' + x
            if x == cam_name:
                camfound = 1
                indexcam = tel
                cam_bin = self.emuBin[tel]
                p = system('pidof %s' % cam_bin)
                if p != '':
                    if int(p) == 0:
                        actcam = self.mlist[tel]
                        print datetime.now()
                        print '[CAMSTARTER] CAM 1 is Running, active cam 1: ' + actcam
                        camrunning = 1
                        if self.FrozenCCcam(actcam):
                            camfrozen = 1
                tel += 1
            elif x == cam_name2:
                camfound2 = 1
                indexcam2 = tel
                cam_bin = self.emuBin[tel]
                p = system('pidof %s' % cam_bin)
                if p != '':
                    if int(p) == 0:
                        actcam = self.mlist[tel]
                        print datetime.now()
                        print '[CAMSTARTER] CAM 2 is Running, active cam 2: ' + actcam
                        camrunning2 = 1
                        if self.FrozenCCcam(actcam):
                            camfrozen2 = 1
                tel += 1
            else:
                tel += 1
        try:

            #// CAM IS NOT RUNNING SO START
            if camrunning == 0 or camfrozen == 1 or (
                    camfound2 == 1 and camrunning2 == 0 or camfrozen2 == 1):
                #// AND CAM IN LIST
                if camfound == 1:
                    stop = self.emuStop[indexcam]
                    print "[CAMSTARTER] CAM 1 not running, stop " + stop
                    self.container = eConsoleAppContainer()
                    self.container.execute(stop)

                    start = self.emuStart[indexcam]
                    print "[CAMSTARTER] no CAM 1 active, starting " + start
                    system(
                        "echo %s Started cam 1 at: %s >> /tmp/camcheck.txt" %
                        (start, datetime.now()))
                    self.container = eConsoleAppContainer()
                    self.container.execute(start)
                    if camrunning2 == 0 or camfrozen2 == 1:
                        #// AND CAM IN LIST
                        if camfound2 == 1:
                            stop = self.emuStop[indexcam2]
                            print "[CAMSTARTER] CAM 2 not running, stop " + stop
                            self.container = eConsoleAppContainer()
                            self.container.execute(stop)

                            import time
                            time.sleep(int(config.softcam.waittime.value))
                            start = self.emuStart[indexcam2]
                            print "[CAMSTARTER] no CAM 2 active, starting " + start
                            system(
                                "echo %s Started cam 2 at: %s >> /tmp/camcheck.txt"
                                % (start, datetime.now()))
                            self.container = eConsoleAppContainer()
                            self.container.execute(start)
            else:
                if camfound == 0:
                    print "[CAMSTARTER] No Cam found to start"

        except:
            print "[CAMSCHECK] Error, can not start Cam"

        global isBusy
        isBusy = None
Exemplo n.º 49
0
 def enterStandby(self, configElement):
     Standby.inStandby.onClose.append(self.endStandby)
     self.container = eConsoleAppContainer()
     self.container.execute('/etc/init.d/boblight-control sleep')
Exemplo n.º 50
0
 def exit(self):
     cmd = 'rm -rf /tmp/ImageDownloader'
     container = eConsoleAppContainer()
     container.execute(cmd)
     self.close()
Exemplo n.º 51
0
def DaemonToggle(session, **kwargs):
    container = eConsoleAppContainer()
    container.execute('/etc/init.d/boblight-control toggle')
Exemplo n.º 52
0
	def __init__(self, session, iface, plugin_path):
		self.skin = setupNfs.skin		
		self.session = session
		Screen.__init__(self, session)

		self.container = eConsoleAppContainer()
		self.container.appClosed.append(self.runFinished)
		self.container.dataAvail.append(self.dataAvail)

		if isRunning('portmap') and isRunning('nfsd'):
			isEnabled = True
		else:
			isEnabled = False

		self.activeConfigEntry = NoSave(ConfigEnableDisable(default = isEnabled))

		self["nfsdLabel"] = Label()
		self["portmapLabel"] = Label()
		self["ButtonGreen"] = Pixmap()
		self["ButtonGreentext"] = Button(_("save and start/restart NFS-Server"))
		self["ButtonRed"] = Pixmap()
		self["ButtonRedtext"] = Label(_("Close"))
		self["ButtonYellow"] = Pixmap()
		self["ButtonYellowtext"] = Label(_("New Entry"))
		self["ButtonBlue"] = Pixmap()
		self["ButtonBluetext"] = Label(_("Remove Entry"))

		self.startingUp = False
		self.goingDown = False
		self.cmdlist = []
		self.run = 0

		self.exportlist = []
		data = self.readExports()
		if data is not None:
			for line in data:
				exportDir = line[0]
				client = line[1]
				options = line[2]
				options = options.replace('(', '')
				options = options.replace(')', '')
				self.exportlist.append((exportDir, client, options))
		else:
			self.exportlist.append(('/media/hdd', '*', 'rw,no_root_squash,sync'))

		self["exportlist"] = List(self.exportlist)
		self.hideList = self["exportlist"].list

		self.createSetup()
		ConfigListScreen.__init__(self, self.list, session = session)
		self.activeConfigEntry.addNotifier(self.toggleServer)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"cancel" : self.cancel,
			"ok"     : self.editExportEntry,
			"green"  : self.green,
			"red"	 : self.cancel,
			"yellow" : self.newExportEntry,
			"blue"   : self.deleteExportEntry
		}, -2)
Exemplo n.º 53
0
 def __init__(self):
     self.container = eConsoleAppContainer()
     self.container.appClosed.append(self.runDone)
     self.queue = []
     self.running = False
Exemplo n.º 54
0
Arquivo: plugin.py Projeto: vuteam/bbh
    def prepareScanData(self, orb, pol, band, is_scan):
        self.is_runable = False
        self.orb_position = orb[0]
        self.feid = int(self.scan_nims.value)
        tab_hilow = {"high": 1, "low": 0}
        tab_pol = {
            "horizontal":
            eDVBFrontendParametersSatellite.Polarisation_Horizontal,
            "vertical":
            eDVBFrontendParametersSatellite.Polarisation_Vertical,
            "circular left":
            eDVBFrontendParametersSatellite.Polarisation_CircularLeft,
            "circular right":
            eDVBFrontendParametersSatellite.Polarisation_CircularRight
        }

        returnvalue = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

        if not self.openFrontend():
            self.oldref = self.session.nav.getCurrentlyPlayingServiceReference(
            )
            self.session.nav.stopService()
            if not self.openFrontend():
                if self.session.pipshown:
                    self.session.pipshown = False
                    del self.session.pip
                    if not self.openFrontend():
                        self.frontend = None
        self.tuner = Tuner(self.frontend)

        if tab_hilow[band]:
            self.scan_sat.frequency.value = 12515
        else:
            self.scan_sat.frequency.value = 11015
        returnvalue = (self.scan_sat.frequency.value, 0, tab_pol[pol], 0, 0,
                       orb[0], eDVBFrontendParametersSatellite.System_DVB_S, 0,
                       0, 0)
        self.tuner.tune(returnvalue)

        if self.getNimSocket(self.feid) < 0:
            print "can't find i2c number!!"
            return
        try:
            cmd = "%s %d %d %d %d %d %d %d %d" % (
                self.binName, self.blindscan_start_frequency.value / 1000000,
                self.blindscan_stop_frequency.value / 1000000,
                self.blindscan_start_symbol.value / 1000000,
                self.blindscan_stop_symbol.value / 1000000, tab_pol[pol],
                tab_hilow[band], self.feid, self.getNimSocket(self.feid))
        except:
            return
        print "prepared command : [%s]" % (cmd)
        self.blindscan_container = eConsoleAppContainer()
        self.blindscan_container.appClosed.append(self.blindscanContainerClose)
        self.blindscan_container.dataAvail.append(self.blindscanContainerAvail)
        self.blindscan_container.execute(cmd)

        tmpstr = "Look for available transponders.\nThis works will take several minutes.\n\n   - Current Status : %d/%d\n   - Orbital Positions : %s\n   - Polarization : %s\n   - Bandwidth : %s" % (
            self.running_count, self.max_count, orb[1], pol, band)
        if is_scan:
            self.blindscan_session = self.session.openWithCallback(
                self.blindscanSessionClose, MessageBox, _(tmpstr),
                MessageBox.TYPE_INFO)
        else:
            self.blindscan_session = self.session.openWithCallback(
                self.blindscanSessionNone, MessageBox, _(tmpstr),
                MessageBox.TYPE_INFO)
Exemplo n.º 55
0
 def clearMemory(self):
     eConsoleAppContainer().execute('sync')
     open('/proc/sys/vm/drop_caches', 'w').write('3')
     self.getMemoryInfo()
Exemplo n.º 56
0
	def __init__(self, session):
		self.modulation = config.plugins.SDGRadio.modulation
		self.frequency = eval("config.plugins.SDGRadio.frequency_%s" % self.modulation.value)
		self.playbackFrequency = None # currently playing frequency
		self.playbackPreset = None # currently playing preset
		self.presets = [] # preset list for current modulation
		self.log = [] # log messages
		self.programs = [] # DAB program list
		self.console = None

		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		self.setTitle(_("Software defined radio"))
		self.skin = SKIN
		self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/SDGRadio")

		for i in range(0, 10):
			self["mem_%d" % i] = MultiPixmap()

		self["modulation"] = Label()
		self["freq"] = Label()
		self["freq_off"] = Label()
		self["freq_units"] = Label()
		self["dab_channel"] = Label()
		self["radiotext"] = Label()
		self["prog_type"] = Label()
		self["pi"] = Label()
		self["traffic"] = Label()
		self["af"] = Label()
		self["ct"] = Label()
		self["eon"] = Label()
		self["rt+"] = Label()
		self["pic"] = Pixmap()
		self["rds_icon"] = Pixmap()
		self["rt_icon"] = Pixmap()
		self["ps_icon"] = Pixmap()

		self["key_red"] = StaticText()
		self["key_green"] = StaticText(_("Play"))
		self["key_yellow"] = StaticText()
		self["key_blue"] = StaticText()

		self["actions"] = HelpableActionMap(self, "SDGRadioActions",
		{
			"cancel": (self.cancel, _("Close plugin")),
			"ok": (self.selectFreq, _("Play current frequency")),

			"info": (self.showPrograms, _("Show DAB program list")),
			"menu": (self.showMenu, _("Open advanced options menu")),

			"red": (self.toggleModulation, _("Change modulation")),
			"green": (self.togglePlayback, _("Start/stop playback")),
			"yellow": (self.yellow, _("Switch RDS on/off")),
			"blue": (self.showInput, _("Open frequency input screen")),
			"blue_long": (self.showLog, _("Cmd execution log")),

			"0": (boundFunction(self.selectPreset, 0), _("Play memory preset %d") % 0),
			"1": (boundFunction(self.selectPreset, 1), _("Play memory preset %d") % 1),
			"2": (boundFunction(self.selectPreset, 2), _("Play memory preset %d") % 2),
			"3": (boundFunction(self.selectPreset, 3), _("Play memory preset %d") % 3),
			"4": (boundFunction(self.selectPreset, 4), _("Play memory preset %d") % 4),
			"5": (boundFunction(self.selectPreset, 5), _("Play memory preset %d") % 5),
			"6": (boundFunction(self.selectPreset, 6), _("Play memory preset %d") % 6),
			"7": (boundFunction(self.selectPreset, 7), _("Play memory preset %d") % 7),
			"8": (boundFunction(self.selectPreset, 8), _("Play memory preset %d") % 8),
			"9": (boundFunction(self.selectPreset, 9), _("Play memory preset %d") % 9),

			"long0": (boundFunction(self.storePreset, 0), _("Store frequency to memory preset %d") % 0),
			"long1": (boundFunction(self.storePreset, 1), _("Store frequency to memory preset %d") % 1),
			"long2": (boundFunction(self.storePreset, 2), _("Store frequency to memory preset %d") % 2),
			"long3": (boundFunction(self.storePreset, 3), _("Store frequency to memory preset %d") % 3),
			"long4": (boundFunction(self.storePreset, 4), _("Store frequency to memory preset %d") % 4),
			"long5": (boundFunction(self.storePreset, 5), _("Store frequency to memory preset %d") % 5),
			"long6": (boundFunction(self.storePreset, 6), _("Store frequency to memory preset %d") % 6),
			"long7": (boundFunction(self.storePreset, 7), _("Store frequency to memory preset %d") % 7),
			"long8": (boundFunction(self.storePreset, 8), _("Store frequency to memory preset %d") % 8),
			"long9": (boundFunction(self.storePreset, 9), _("Store frequency to memory preset %d") % 9),

			"up": (boundFunction(self.freqUp, "1"), _("Increase frequency by 1 MHz / KHz")),
			"down": (boundFunction(self.freqDown, "1"), _("Decrease frequency by 1 MHz / KHz")),
			"upRepeated": (boundFunction(self.freqUp, "10"), _("Increase frequency by 10 MHz / KHz (long press)")),
			"downRepeated": (boundFunction(self.freqDown, "10"), _("Decrease frequency by 10 MHz / KHz (long press)")),

			"right": (boundFunction(self.freqUp, "0.05"), _("Increase frequency by 0.05 MHz")),
			"left": (boundFunction(self.freqDown, "0.05"), _("Decrease frequency by 0.05 MHz")),
			"rightRepeated": (boundFunction(self.freqUp, "0.1"), _("Increase frequency by 0.1 MHz (long press)")),
			"leftRepeated": (boundFunction(self.freqDown, "0.1"), _("Decrease frequency by 0.1 MHz (long press)")),

			"nextBouquet": (boundFunction(self.freqUp, "0.0001"), _("Increase frequency by 0.0001 MHz")),
			"prevBouquet": (boundFunction(self.freqDown, "0.0001"), _("Decrease frequency by 0.0001 MHz")),
		}, -2)

		self.onLayoutFinish.extend([self.getConfigOptions, self.getPresets, self.updateFreqWidget,
									self.updateExtraWidgets, self.redText, self.yellowText, self.blueText])

		self.oldService = self.session.nav.getCurrentlyPlayingServiceReference() # get currently playing service
		self.session.nav.stopService() # stop currently playing service
		eConsoleAppContainer().execute("showiframe /usr/share/enigma2/radio.mvi") # display radio mvi
Exemplo n.º 57
0
 def DaemonStop(self):
     self.container = eConsoleAppContainer()
     self.container.execute('/etc/init.d/boblight-control stop')
     self.session.open(MessageBox, _('Stop all clients...'), MessageBox.TYPE_INFO, timeout=3)
     self.createConfigList()
Exemplo n.º 58
0
    def __init__(self, request, session):
        self.request = request

        mode = None
        graboptions = [GRAB_PATH, '-q', '-s']

        fileformat = getUrlArg(request, "format", "jpg")
        if fileformat == "jpg":
            graboptions.append("-j")
            graboptions.append("95")
        elif fileformat == "png":
            graboptions.append("-p")
        elif fileformat != "bmp":
            fileformat = "bmp"

        size = getUrlArg(request, "r")
        if size != None:
            graboptions.append("-r")
            graboptions.append("%d" % int(size))

        mode = getUrlArg(request, "mode")
        if mode != None:
            if mode == "osd":
                graboptions.append("-o")
            elif mode == "video":
                graboptions.append("-v")
            elif mode == "pip":
                graboptions.append("-v")
                if InfoBar.instance.session.pipshown:
                    graboptions.append("-i 1")
            elif mode == "lcd":
                eDBoxLCD.getInstance().dumpLCD()
                fileformat = "png"
                command = "cat /tmp/lcdshot.%s" % fileformat

        self.filepath = "/tmp/screenshot." + fileformat
        self.container = eConsoleAppContainer()
        self.container.appClosed.append(self.grabFinished)
        self.container.stdoutAvail.append(request.write)
        self.container.setBufferSize(32768)
        if mode == "lcd":
            if self.container.execute(command):
                raise Exception("failed to execute: ", command)
            sref = 'lcdshot'
        else:
            self.container.execute(GRAB_PATH, *graboptions)
            try:
                if mode == "pip" and InfoBar.instance.session.pipshown:
                    ref = InfoBar.instance.session.pip.getCurrentService(
                    ).toString()
                else:
                    ref = session.nav.getCurrentlyPlayingServiceReference(
                    ).toString()
                sref = '_'.join(ref.split(':', 10)[:10])
                if config.OpenWebif.webcache.screenshotchannelname.value:
                    sref = ServiceReference(ref).getServiceName()
            except:  # nosec # noqa: E722
                sref = 'screenshot'
        sref = sref + '_' + time.strftime("%Y%m%d%H%M%S",
                                          time.localtime(time.time()))
        request.notifyFinish().addErrback(self.requestAborted)
        request.setHeader('Content-Disposition',
                          'inline; filename=%s.%s;' % (sref, fileformat))
        request.setHeader('Content-Type',
                          'image/%s' % fileformat.replace("jpg", "jpeg"))
Exemplo n.º 59
0
    def __init__(self, session):
        Screen.__init__(self, session)

        for i in range(0, 10):
            self["mem_%d" % i] = Pixmap()

        self["freq"] = Label()
        self["radiotext"] = Label()
        self["prog_type"] = Label()
        self["key_red"] = Label(_("Exit"))
        self["key_green"] = Label(_("Save"))
        if config.sdgradio.rds.value:
            self["key_yellow"] = Label(_("RDS On"))
        else:
            self["key_yellow"] = Label(_("RDS Off"))
        self["key_blue"] = Label(_("Log"))
        self["info"] = Label(_("Info"))

        # get currently playing service
        self.oldService = self.session.nav.getCurrentlyPlayingServiceReference(
        )

        # stop currently playing service
        self.session.nav.stopService()

        # log messages
        self.log = []

        # display radio mvi
        eConsoleAppContainer().execute(
            "showiframe /usr/share/enigma2/radio.mvi")

        #self.Scale = AVSwitch().getFramebufferScale()

        self["actions"] = ActionMap(
            [
                "SetupActions", "DirectionActions", "WizardActions",
                "ColorActions", "MenuActions", "ChannelSelectEPGActions"
            ],
            {
                "cancel": self.
                cancel,  # add the RC Command "cancel" to close your Screen
                "0": boundFunction(self.buttonNumber, 0),
                "1": boundFunction(self.buttonNumber, 1),
                "2": boundFunction(self.buttonNumber, 2),
                "3": boundFunction(self.buttonNumber, 3),
                "4": boundFunction(self.buttonNumber, 4),
                "5": boundFunction(self.buttonNumber, 5),
                "6": boundFunction(self.buttonNumber, 6),
                "7": boundFunction(self.buttonNumber, 7),
                "8": boundFunction(self.buttonNumber, 8),
                "9": boundFunction(self.buttonNumber, 9),
                "up": self.up,
                "down": self.down,
                "left": self.left,
                "right": self.right,
                "ok": self.ok,
                "upRepeated": self.up,
                "downRepeated": self.down,
                "leftRepeated": self.left,
                "rightRepeated": self.right,
                "info": self.info,
                #"red": self.red,
                "green": self.green,
                "yellow": self.yellow,
                "blue": self.blue,
            },
            -1)

        self.Console = None
        self.onLayoutFinish.append(self.ShowPicture)
Exemplo n.º 60
0
 def endStandby(self):
     self.container = eConsoleAppContainer()
     self.container.execute('/etc/init.d/boblight-control wakeup')