Exemplo n.º 1
0
    def onStart(self):
        #check if Xbian is upgrading
        if os.path.isfile('/var/lock/.upgrades') :
            if xbianConfig('updates','progress')[0] == '1':
                dlg = dialogWait('XBian Update','Please wait while updating')
                dlg.show()
                while not self.StopRequested and xbianConfig('updates','progress')[0] == '1':
                    xbmc.sleep(2000)
                dlg.close()
                if self.StopRequested :
                    return              
            xbmc.executebuiltin("Notification(%s,%s)"%('XBian Upgrade','XBian was updated successfully'))
            os.remove('/var/lock/.upgrades')
        
        #check is packages is updating
        if os.path.isfile('/var/lock/.packages') :
            if xbianConfig('updates','progress')[0] == '1':
                dlg = dialogWait('XBian Update','Please wait while updating')
                dlg.show()
                while not self.StopRequested and xbianConfig('updates','progress')[0] == '1':
                    xbmc.sleep(2000)
                dlg.close()
                if self.StopRequested :
                    return              
            xbmc.executebuiltin("Notification(%s,%s)"%('Package Update','Package was updated successfully'))
            os.remove('/var/lock/.packages')
        #for those one who deactivate its screensaver, force check every 10 days
        if getSetting('lastupdatecheck') != None and getSetting('lastupdatecheck') < datetime.now() - timedelta(days=10):
			self.onScreensaverActivated()
			self.onScreensaverDeactivated()
        while not self.StopRequested: #End if XBMC closes
            xbmc.sleep(100) #Repeat (ms) 
Exemplo n.º 2
0
 def onInit(self):
     from resources.lib.utils import dialogWait
     self.wait = dialogWait(_('Loading'), _('Please wait...'))
     self.wait.show()
     from resources.lib.xbianDialog import XbianDialog
     self.title = ''
     self.settings = []
     self.window = XbianDialog('SettingsXbianDialog.xml', ROOTDIR)
 def onInit(self):
     from resources.lib.utils import dialogWait
     self.wait = dialogWait(_('Loading'), _('Please wait...'))
     self.wait.show()
     from resources.lib.xbianDialog import XbianDialog
     self.title = ''
     self.settings = []
     open(os.path.join(ROOTDIR, 'resources', 'skins', SKIN_DIR, SKIN_RES, 'SettingsXbianDialog.xml'), 'w').close()
     self.window = XbianDialog('SettingsXbianDialog.xml', ROOTDIR)
Exemplo n.º 4
0
    def onUpdate(self,updateId):
        lockfile = '/var/lock/.%s'%self.key
        open(lockfile,'w').close()
        updateId = str(updateId)        
        if self.askConfirmation(True) :
			dlg = dialogWait('Xbian Update','Please wait while updating')
			dlg.show()			
			rc =xbianConfig('updates','install',self.key,updateId)
			if rc and rc[0] == '1' :
				#wait upgrade
				while not xbmc.abortRequested and xbianConfig('updates','progress')[0] == '1':
					time.sleep(2)
				if xbmc.abortRequested :
					return None
				else :
					os.remove(lockfile) 
					#remove update from list
					updateList = updateId.split(' ')
					for updates in updateList :
						for update in self.xbianValue :
							if update.split(';')[0] == updates :
								self.xbianValue.remove(update)
								self.control.removeUpdate(update)
								break
					dlg.close()
					self.notifyOnSuccess()
			else :
				if rc and rc[0] == '2' :
					self.ERRORTEXT = 'These packages are already updated'           
				elif rc and rc[0] == '3' :
					self.ERRORTEXT = 'Packages not found in apt repository'
				elif rc and rc[0] == '4' :
					self.ERRORTEXT = 'Packages not found in apt repository'
				elif rc and rc[0] == '5' :
					self.ERRORTEXT = 'There is a size mismatch for the remote packages'             
				elif rc and rc[0] == '6' :
					self.ERRORTEXT = 'The packages itselves got a internal error'
				else :
					self.ERRORTEXT = 'Unexpected error'            
				os.remove(lockfile)
				dlg.close()
				self.notifyOnError()    
Exemplo n.º 5
0
 def __init__(self):
     xbmc.log("XBian : XBian-config-python started")
     self.onRun = os.path.join("/", "tmp", ".xbian_config_python")
     if os.path.isfile(self.onRun):
         xbmcgui.Dialog().ok("XBian-config", "XBian-config is still running", "Please wait...")
     else:
         open(self.onRun, "w").close()
         try:
             self.CmdQueue = Queue.Queue()
             self.updateThread = Updater(self.CmdQueue)
             self.updateThread.start()
             self.wait = xbmcgui.DialogProgress()
             self.window = XbianWindow("SettingsXbianInfo.xml", ROOTDIR)
             self.category_list = []
             self.category_list_thread = []
             self.category_list_instance = {}
             self.finished = 0
             self.stop = False
             for fn in os.listdir(os.path.join(ROOTDIR, CATEGORY_PATH)):
                 if fn[0] != "_" and fn.split(".")[-1] in ("py", "pyw"):
                     modulename = fn.split(".")[0]  # filename without extension
                     self.category_list.append(modulename)
             self.category_list.sort()
             self.total = len(self.category_list)
             self.wait.create("Generating Windows", "Please wait..., this process can take up to one minute")
             self.wait.update(0)
             for module in self.category_list:
                 self.category_list_thread.append(threading.Thread(None, self.threadInitCategory, None, (module,)))
                 self.category_list_thread[-1].start()
             for i, threadInst in enumerate(self.category_list_thread):
                 if not self.stop:
                     threadInst.join()
                     try:
                         self.window.addCategory(self.category_list_instance[self.category_list[i]])
                     except:
                         xbmc.log(
                             "XBian : Cannot add category: %s \n%s"
                             % (str(self.category_list[i]), str(sys.exc_info()))
                         )
             if not self.stop:
                 self.window.doXml(
                     os.path.join(ROOTDIR, "resources", "skins", "Default", "720p", "SettingsXbianInfo.template")
                 )
                 self.wait.close()
                 self.window.doModal()
                 xbmc.log("XBian : XBian-config-python closed")
                 self.window.stopRequested = True
                 progress = dialogWait("XBian config", "Checking if reboot is needed...")
                 progress.show()
                 rebootneeded = xbianConfig("reboot")
                 progress.close()
                 if rebootneeded and rebootneeded[0] == "1":
                     if xbmcgui.Dialog().yesno("XBian-config", "A reboot is needed", "Do you want to reboot now?"):
                         # reboot
                         xbmc.executebuiltin("Reboot")
         except:
             self.window.stopRequested = True
             xbmcgui.Dialog().ok(
                 "XBian-config",
                 "Something went wrong while creating the window",
                 "Please contact us on www.xbian.org for further support",
             )
             xbmc.log("XBian : Cannot create Main window: %s" % (str(sys.exc_info())))
         finally:
             self.updateThread.stop()
             os.remove(self.onRun)
Exemplo n.º 6
0
 def __init__(self) :              
     xbmc.log('XBian : XBian-config-python started')
     self.onRun = os.path.join('/','tmp','.xbian_config_python')
     self.bootMnt = os.path.ismount('/boot')
     if os.path.isfile(self.onRun) :
         xbmcgui.Dialog().ok('XBian-config','XBian-config is still running','Please wait...')
     else :      
         open(self.onRun,'w').close()
         try :            
             #mount boot if not mounted
             if not self.bootMnt :
                 xbmc.log('XBian : Mount /boot')
                 subprocess.check_call(['mount','/boot'])                    
             self.CmdQueue = Queue.Queue()
             self.updateThread = Updater(self.CmdQueue)
             self.updateThread.start()
             self.wait = xbmcgui.DialogProgress()
             self.window = XbianWindow('SettingsXbianInfo.xml',ROOTDIR)
             self.category_list = []
             self.category_list_thread = []
             self.category_list_instance = {}
             self.finished = 0
             self.stop = False
             for fn in os.listdir(os.path.join(ROOTDIR,CATEGORY_PATH)):
                 if fn[0] != '_' and fn.split('.')[-1] in ('py', 'pyw'):
                     modulename = fn.split('.')[0] # filename without extension
                     self.category_list.append(modulename)
             self.category_list.sort()
             self.total = len(self.category_list)
             self.wait.create('Generating Windows','Please wait..., this process can take up to one minute')
             self.wait.update(0)
             for module in self.category_list :
                 self.category_list_thread.append(threading.Thread(None,self.threadInitCategory, None, (module,)))
                 self.category_list_thread[-1].start()
             for i,threadInst in enumerate(self.category_list_thread):
                 if not self.stop :
                     threadInst.join()
                     try :
                         self.window.addCategory(self.category_list_instance[self.category_list[i]])
                     except:
                         xbmc.log('XBian : Cannot add category: %s \n%s'%(str(self.category_list[i]),str(sys.exc_info())))                            
             if not self.stop :
                 self.window.doXml(os.path.join(ROOTDIR,'resources','skins',SKIN_DIR,'720p','SettingsXbianInfo.template'))
                 self.wait.close()                    
                 self.window.doModal() 
                 xbmc.log('XBian : XBian-config-python closed')
                 self.window.stopRequested = True 
                 progress = dialogWait('XBian config','Checking if reboot is needed...')
                 progress.show() 
                 rebootneeded = xbianConfig('reboot')
                 progress.close()
                 if rebootneeded and rebootneeded[0] == '1' :
                     if xbmcgui.Dialog().yesno('XBian-config','A reboot is needed','Do you want to reboot now?') :
                         #reboot
                         xbmc.executebuiltin('Reboot')
         except :
             self.window.stopRequested = True            
             xbmcgui.Dialog().ok('XBian-config','Something went wrong while creating the window','Please contact us on www.xbian.org for further support')
             xbmc.log('XBian : Cannot create Main window: %s'%(str(sys.exc_info())))                            
         finally :                
             self.updateThread.stop()
             os.remove(self.onRun)                
             if not self.bootMnt :
                 xbmc.log('XBian :  unmount /boot')
                 subprocess.check_call(['umount','/boot'])