• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.getSetting函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中resources.lib.utils.getSetting函数的典型用法代码示例。如果您正苦于以下问题:Python getSetting函数的具体用法?Python getSetting怎么用?Python getSetting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getSetting函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: start

    def start(self):

        #check if a backup should be resumed
        resumeRestore = self._resumeCheck()

        if(resumeRestore):
            restore = XbmcBackup()
            restore.selectRestore(self.restore_point)
            #skip the advanced settings check
            restore.skipAdvanced()
            restore.run(XbmcBackup.Restore)
        
        while(not xbmc.abortRequested):
            
            if(self.enabled == "true"):
                #scheduler is still on
                now = time.time()

                if(self.next_run <= now):
                    progress_mode = int(utils.getSetting('progress_mode'))
                    self.doScheduledBackup(progress_mode)

                    #check if we should shut the computer down
                    if(utils.getSetting("cron_shutdown") == 'true'):
                        #wait 10 seconds to make sure all backup processes and files are completed
                        time.sleep(10)
                        xbmc.executebuiltin('ShutDown()')
                    else:
                        #find the next run time like normal
                        self.findNextRun(now)

            xbmc.sleep(500)

        #delete monitor to free up memory
        del self.monitor
开发者ID:robweber,项目名称:xbmcbackup,代码行数:35,代码来源:scheduler.py


示例2: start

    def start(self):
        while(not xbmc.abortRequested):
            current_enabled = utils.getSetting("enable_scheduler")
            
            if(current_enabled == "true" and self.enabled == "false"):
                #scheduler was just turned on
                self.enabled = current_enabled
                self.setup()
            elif (current_enabled == "false" and self.enabled == "true"):
                #schedule was turn off
                self.enabled = current_enabled
            elif(self.enabled == "true"):
                #scheduler is still on
                now = time.time()

                if(self.next_run <= now):
                    if(utils.getSetting('run_silent') == 'false'):
                        utils.showNotification(utils.getString(30053))
                    #run the job in backup mode, hiding the dialog box
                    backup = XbmcBackup()
                    backup.run(XbmcBackup.Backup,True)
                    
                self.findNextRun(now)

            time.sleep(10)
开发者ID:dersphere,项目名称:xbmcbackup,代码行数:25,代码来源:scheduler.py


示例3: __init__

    def __init__(self):
        self.monitor = UpdateMonitor(update_method = self.settingsChanged)
        self.enabled = utils.getSetting("enable_scheduler")
        self.next_run_path = xbmc.translatePath(utils.data_dir()) + 'next_run.txt'

        if(self.enabled == "true"):

            nr = 0
            if(xbmcvfs.exists(self.next_run_path)):

                fh = xbmcvfs.File(self.next_run_path)
                try:
                    #check if we saved a run time from the last run
                    nr = float(fh.read())
                except ValueError:
                    nr = 0

                fh.close()

            #if we missed and the user wants to play catch-up
            if(0 < nr <= time.time() and utils.getSetting('schedule_miss') == 'true'):
                utils.log("scheduled backup was missed, doing it now...")
                progress_mode = int(utils.getSetting('progress_mode'))
                
                if(progress_mode == 0):
                    progress_mode = 1 # Kodi just started, don't block it with a foreground progress bar

                self.doScheduledBackup(progress_mode)
                
            self.setup()
开发者ID:robweber,项目名称:xbmcbackup,代码行数:30,代码来源:scheduler.py


示例4: cleanLibrary

    def cleanLibrary(self,media_type):
        #check if we should verify paths
        if(utils.getSetting("verify_paths") == 'true'):
            response = eval(xbmc.executeJSONRPC('{ "jsonrpc" : "2.0", "method" : "Files.GetSources", "params":{"media":"' + media_type + '"}, "id": 1}'))

            if(response.has_key('error')):
                utils.log("Error " + response['error']['data']['method'] + " - " + response['error']['message'],xbmc.LOGDEBUG)
                return
            
            for source in response['result']['sources']:
                if not self._sourceExists(source['file']):
                    #let the user know this failed, if they subscribe to notifications
                    if(utils.getSetting('notify_next_run') == 'true'):
                        utils.showNotification(utils.getString(30050),"Source " + source['label'] + " does not exist")

                    utils.log("Path " + source['file'] + " does not exist")
                    return

        #also check if we should verify with user first
        if(utils.getSetting('user_confirm_clean') == 'true'):
            #user can decide 'no' here and exit this
            runClean = xbmcgui.Dialog().yesno(utils.getString(30000),utils.getString(30052),utils.getString(30053))
            if(not runClean):
                return
                
        #run the clean operation
        utils.log("Cleaning Database")
        xbmc.executebuiltin("CleanLibrary(" + media_type + ")")

        #write last run time, will trigger notifications
        self.writeLastRun()
开发者ID:NEOhidra,项目名称:xbmclibraryautoupdate,代码行数:31,代码来源:service.py


示例5: runProgram

    def runProgram(self):
        #a one-time catch for the startup delay
        if(int(utils.getSetting("startup_delay")) != 0):
            count = 0
            while count < len(self.schedules):
                if(time.time() > self.schedules[count].next_run):
                    #we missed at least one update, fix this
                    self.schedules[count].next_run = time.time() + int(utils.getSetting("startup_delay")) * 60
                count = count + 1
                
        #program has started, check if we should show a notification
        self.showNotify()

        while(not xbmc.abortRequested):

            #don't check unless new minute
            if(time.time() > self.last_run + 60):
                self.readLastRun()

                self.evalSchedules()

            xbmc.sleep(self.sleep_time)

        #clean up monitor on exit
        del self.monitor
开发者ID:NEOhidra,项目名称:xbmclibraryautoupdate,代码行数:25,代码来源:service.py


示例6: onStart

    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) 
开发者ID:sjengfred,项目名称:plugin.xbianconfig,代码行数:32,代码来源:upgrade.py


示例7: settingsChanged

    def settingsChanged(self):
        utils.log("Settings changed - update")
        old_settings = utils.refreshAddon()
        current_enabled = utils.getSetting("enable_scheduler")
        install_keyboard_file = utils.getSetting("install_keyboard_file")
        if install_keyboard_file == 'true':
          self.installKeyboardFile()
          utils.setSetting('install_keyboard_file', 'false')
          # Return since this is going to be run immediately again
          return
        
        # Update m3u file if wanted groups has changed
        old_groups = self.groups
        self.updateGroups()
        if self.groups != old_groups or old_settings.getSetting("username") != utils.getSetting("username") or old_settings.getSetting("password") != utils.getSetting("password") or old_settings.getSetting("mergem3u_fn") != utils.getSetting("merge3mu_fn") or old_settings.getSetting("mergem3u") != utils.getSetting("mergem3u"):
          self.update_m3u = True

        if old_settings.getSetting("timezone") != utils.getSetting("timezone"):
          if self.pvriptvsimple_addon:
            utils.log("Changing offset")
            self.checkAndUpdatePVRIPTVSetting("epgTimeShift", utils.getSetting("timezone"))

        if(self.enabled == "true"):
            #always recheck the next run time after an update
            utils.log('recalculate start time , after settings update')
            self.findNextRun(time.time())
开发者ID:taylorhui,项目名称:iptvsubs2pvriptvsimple,代码行数:26,代码来源:service.py


示例8: start

    def start(self):

        #check if a backup should be resumed
        resumeRestore = self._resumeCheck()

        if(resumeRestore):
            restore = XbmcBackup()
            restore.selectRestore(self.restore_point)
            #skip the advanced settings check
            restore.skipAdvanced()
            restore.run(XbmcBackup.Restore)
        
        while(not xbmc.abortRequested):
            
            if(self.enabled == "true"):
                #scheduler is still on
                now = time.time()

                if(self.next_run <= now):
                    if(utils.getSetting('run_silent') == 'false'):
                        utils.showNotification(utils.getString(30053))
                    #run the job in backup mode, hiding the dialog box
                    backup = XbmcBackup()
                    backup.run(XbmcBackup.Backup,True)

                    #check if we should shut the computer down
                    if(utils.getSetting("cron_shutdown") == 'true'):
                        #wait 10 seconds to make sure all backup processes and files are completed
                        time.sleep(10)
                        xbmc.executebuiltin('ShutDown()')
                    else:
                        #find the next run time like normal
                        self.findNextRun(now)

            xbmc.sleep(500)
开发者ID:khaledlfc,项目名称:xbmcbackup,代码行数:35,代码来源:scheduler.py


示例9: parseSchedule

    def parseSchedule(self):
        schedule_type = int(utils.getSetting("schedule_interval"))
        cron_exp = utils.getSetting("cron_schedule")
        if self.schedule_time:
            hour, minute = self.schedule_time.split(':')
            hour = int(hour)
            minute = int(minute)

            cron_exp = str(minute) + ' ' + str(hour)  + ' * * *'
            return cron_exp
开发者ID:krazinabox,项目名称:UFO-IPTV,代码行数:10,代码来源:service.py


示例10: evalSchedules

    def evalSchedules(self):
        if not self.lock:
            now = time.time()

            count = 0
            tempLastRun = self.last_run
            while count < len(self.schedules):
                cronJob = self.schedules[count]

                if cronJob.next_run <= now:
                    if xbmc.Player().isPlaying() == False or utils.getSetting("run_during_playback") == "true":

                        if utils.getSetting("run_on_idle") == "false" or (
                            utils.getSetting("run_on_idle") == "true" and self.monitor.screensaver_running
                        ):

                            # check for valid network connection
                            if self._networkUp():

                                # check if this scan was delayed due to playback
                                if cronJob.on_delay == True:
                                    # add another minute to the delay
                                    self.schedules[count].next_run = now + 60
                                    self.schedules[count].on_delay = False
                                    utils.log(cronJob.name + " paused due to playback")

                                elif self.scanRunning() == False:
                                    # run the command for this job
                                    utils.log(cronJob.name)

                                    if cronJob.timer_type == "xbmc":
                                        xbmc.executebuiltin(cronJob.command)
                                    else:
                                        self.cleanLibrary(cronJob.command)

                                    # find the next run time
                                    cronJob.next_run = self.calcNextRun(cronJob.expression, now)
                                    self.schedules[count] = cronJob

                                elif self.scanRunning() == True:
                                    self.schedules[count].on_delay = True
                                    utils.log("Waiting for other scan to finish")
                            else:
                                utils.log("Network down, not running")
                        else:
                            utils.log("Skipping scan, only run when idle")
                    else:
                        self.schedules[count].on_delay = True
                        utils.log("Player is running, wait until finished")

                count = count + 1

            # write last run time
            now = time.time()
            self.last_run = now - (now % 60)
开发者ID:struart,项目名称:xbmclibraryautoupdate,代码行数:55,代码来源:service.py


示例11: checkTimer

    def checkTimer(self,settingName):
        result = ''
        
        #figure out if using standard or advanced timer
        if(utils.getSetting(settingName + '_advanced_timer') == 'true'):
            #copy the expression
            result = utils.getSetting(settingName + "_cron_expression")
        else:
            result = '0 */' + str(self.timer_amounts[utils.getSetting(settingName + "_timer")]) + ' * * *'

        return result
开发者ID:NEOhidra,项目名称:xbmclibraryautoupdate,代码行数:11,代码来源:service.py


示例12: checkTimer

    def checkTimer(self, settingName):
        result = ""

        # figure out if using standard or advanced timer
        if utils.getSetting(settingName + "_advanced_timer") == "true":
            # copy the expression
            result = utils.getSetting(settingName + "_cron_expression")
        else:
            result = "0 */" + str(self.timer_amounts[utils.getSetting(settingName + "_timer")]) + " * * *"

        return result
开发者ID:struart,项目名称:xbmclibraryautoupdate,代码行数:11,代码来源:service.py


示例13: start

    def start(self):

        #check if a backup should be resumed
        resumeRestore = self._resumeCheck()

        if(resumeRestore):
            restore = XbmcBackup()
            restore.selectRestore(self.restore_point)
            #skip the advanced settings check
            restore.skipAdvanced()
            restore.run(XbmcBackup.Restore)
        
        while(not xbmc.abortRequested):
            
            if(self.enabled == "true"):
                #scheduler is still on
                now = time.time()

                if(self.next_run <= now):
                    progress_mode = int(utils.getSetting('progress_mode'))
                    if(progress_mode != 2):
                        utils.showNotification(utils.getString(30053))
                    
                    backup = XbmcBackup()

                    if(backup.remoteConfigured()):

                        if(int(utils.getSetting('progress_mode')) in [0,1]):
                            backup.run(XbmcBackup.Backup,True)
                        else:
                            backup.run(XbmcBackup.Backup,False)

                        #check if this is a "one-off"
                        if(int(utils.getSetting("schedule_interval")) == 0):
                            #disable the scheduler after this run
                            self.enabled = "false"
                            utils.setSetting('enable_scheduler','false')
                    else:
                        utils.showNotification(utils.getString(30045))
                        
                    #check if we should shut the computer down
                    if(utils.getSetting("cron_shutdown") == 'true'):
                        #wait 10 seconds to make sure all backup processes and files are completed
                        time.sleep(10)
                        xbmc.executebuiltin('ShutDown()')
                    else:
                        #find the next run time like normal
                        self.findNextRun(now)

            xbmc.sleep(500)

        #delete monitor to free up memory
        del self.monitor
开发者ID:EDUARDO1122,项目名称:Halowrepo,代码行数:53,代码来源:scheduler.py


示例14: playStarted

    def playStarted(self):
        
        if(self.playerMonitor.isPlayingVideo() and utils.getSetting('monitor_video') == 'true'):
            videoTag = self.playerMonitor.getVideoInfoTag()

            utils.log("Logging: " + videoTag.getTitle(),xbmc.LOGDEBUG)
            self.historyDB.insert(("video",videoTag.getTitle(),self.playerMonitor.getPlayingFile(),int(time.time())))
            
        elif(self.playerMonitor.isPlayingAudio() and utils.getSetting('monitor_music') == 'true'):
            audioTag = self.playerMonitor.getMusicInfoTag()

            utils.log("Logging: " + audioTag.getTitle(),xbmc.LOGDEBUG)
            self.historyDB.insert(('audio',audioTag.getTitle(),self.playerMonitor.getPlayingFile(),int(time.time())))
开发者ID:robweber,项目名称:service.history,代码行数:13,代码来源:default.py


示例15: onScreensaverActivated

 def onScreensaverActivated(self):
     print 'screensaver activated'                
     if not xbmc.Player().isPlaying() and (getSetting('lastupdatecheck') == None  or getSetting('lastupdatecheck') < datetime.now() - timedelta(days=1)):			
         print 'XBian : Checking for update'
         #check if new upgrade avalaible
         rc =xbianConfig('updates','list','upgrades')
         if rc and rc[0] == '-3' :
             rctmp = xbianConfig('updates','updatedb')
             if rctmp and rctmp[0] == '1' :
                  rc =xbianConfig('updates','list','upgrades')
             else :
                 rc[0]= '0'
         if rc and rc[0] not in ('0','-2') :
             retval = rc[0].split(';') 
             self.xbianUpdate = retval[3]            
        
        #check if new update package avalaible
         rc =xbianConfig('updates','list','packages')
         if rc and rc[0] == '-3' :
             rctmp = xbianConfig('updates','updatedb')
             if rctmp and rctmp[0] == '1' :
                  rc =xbianConfig('updates','list','packages')
             else :
                 rc[0]= '0'
         if rc and rc[0] not in ('0','-2') :
             self.packageUpdate = True
         setSetting('lastupdatecheck',datetime.now())
开发者ID:sjengfred,项目名称:plugin.xbianconfig,代码行数:27,代码来源:upgrade.py


示例16: run

    def run(self):
        mode = xbmcgui.Dialog().select(utils.getString(30010),[utils.getString(30011),utils.getString(30012)])

        copyComplete = False
        if(mode == self.REMOTE_MODE):
            copyComplete = self._copyFile(utils.getSetting('remote_filename'))
        elif(mode == self.LOCAL_MODE):
            copyComplete = self._copyFile(utils.getSetting('local_filename'))

        
        if(copyComplete):
            #prompt the user to restart xbmc
            restartXbmc = xbmcgui.Dialog().yesno(utils.getString(30010),"",utils.getString(30013))

            if(restartXbmc):
                xbmc.restart();
开发者ID:robweber,项目名称:script.toggle.local,代码行数:16,代码来源:default.py


示例17: parseSchedule

    def parseSchedule(self):
        schedule_type = int(utils.getSetting("schedule_interval"))
        cron_exp = utils.getSetting("cron_schedule")

        hour_of_day = utils.getSetting("schedule_time")
        hour_of_day = int(hour_of_day[0:2])
        if(schedule_type == 0 or schedule_type == 1):
            #every day
            cron_exp = "0 " + str(hour_of_day) + " * * *"
        elif(schedule_type == 2):
            #once a week
            day_of_week = utils.getSetting("day_of_week")
            cron_exp = "0 " + str(hour_of_day) + " * * " + day_of_week
        elif(schedule_type == 3):
            #first day of month
            cron_exp = "0 " + str(hour_of_day) + " 1 * *"

        return cron_exp
开发者ID:NEOhidra,项目名称:xbmcbackup,代码行数:18,代码来源:scheduler.py


示例18: __init__

    def __init__(self):
        utils.log("Grab Fanart Service Started")
        
        #setup the window and file list
        self.WINDOW = xbmcgui.Window(10000)
        self.xbmc_tv = list()
        self.xbmc_movies = list()
        self.xbmc_music = list()

        #let XBMC know the script is not ready yet
        self.WINDOW.setProperty('script.grab.fanart.Ready',"")

        #start populating the arrays right away - don't use threads here
        if(utils.getSetting('mode') == '' or utils.getSetting('mode') == 'random'):
            self.grabRandom()
        else:
            self.grabRecent()
                    
        self.refresh_media = time() + (60 * 60)  #refresh again in 60 minutes
开发者ID:YourFriendCaspian,项目名称:dotfiles,代码行数:19,代码来源:service.py


示例19: doScheduledBackup

 def doScheduledBackup(self,progress_mode):
     if(progress_mode != 2):
         utils.showNotification(utils.getString(30053))
     
     backup = XbmcBackup()
     
     if(backup.remoteConfigured()):
         
         if(int(utils.getSetting('progress_mode')) in [0,1]):
             backup.run(XbmcBackup.Backup,True)
         else:
             backup.run(XbmcBackup.Backup,False)
         
         #check if this is a "one-off"
         if(int(utils.getSetting("schedule_interval")) == 0):
             #disable the scheduler after this run
             self.enabled = "false"
             utils.setSetting('enable_scheduler','false')
     else:
         utils.showNotification(utils.getString(30045))
开发者ID:robweber,项目名称:xbmcbackup,代码行数:20,代码来源:scheduler.py


示例20: _delete

    def _delete(self,id):
        #check if we need PIN confirmation to do this
        if(utils.getSetting('require_pin_on_delete') == 'true'):
            user_try = xbmcgui.Dialog().numeric(0,'PIN Required')

            if(self.settings.checkPIN(user_try)):
                self.historyDB.delete(id)
                xbmc.executebuiltin('Container.Refresh')
            else:
                xbmcgui.Dialog().ok('Error','Incorrect PIN')
        else:
            self.historyDB.delete(id)
            xbmc.executebuiltin('Container.Refresh')
开发者ID:robweber,项目名称:service.history,代码行数:13,代码来源:gui.py



注:本文中的resources.lib.utils.getSetting函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.getString函数代码示例发布时间:2022-05-26
下一篇:
Python utils.getHtml函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap