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

Python settings.log函数代码示例

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

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



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

示例1: _updatePlaylistForSettings

    def _updatePlaylistForSettings(self, playlist):
        if playlist.size() < 1:
            return playlist

        filename = playlist[0].getfilename()
        duration = self._getVideoDuration(filename)
        log("Duration is %d for file %s" % (duration, filename))

        startTime = 0

        # Check if we have a random start time
        if Settings.isRandomStart():
            startTime = random.randint(0, int(duration * 0.75))

        clockStart = Settings.getTimeForClock(filename, duration)
        if clockStart > 0:
            startTime = clockStart

        # Set the random start
        if (startTime > 0) and (duration > 10):
            listitem = xbmcgui.ListItem()
            # Record if the theme should start playing part-way through
            listitem.setProperty('StartOffset', str(startTime))

            log("Setting start of %d for %s" % (startTime, filename))

            # Remove the old item from the playlist
            playlist.remove(filename)
            # Add the new item at the start of the list
            playlist.add(filename, listitem, 0)

        return playlist
开发者ID:robwebset,项目名称:screensaver.video,代码行数:32,代码来源:screensaver.py


示例2: check

    def check(self):
        # Check to see if we should be changing the video for the schedule
        scheduleEntry = self.scheduler.getScheduleEntry()
        # There is an item scheduled, so check to see if the item has actually changed
        if scheduleEntry == self.currentScheduleItem:
            return None

        log("Old Schedule %d different from new: %d" % (self.currentScheduleItem, scheduleEntry))

        # Check to see if there needs to be a change in what is playing
        # This will also update the schedule item so we know what has been selected
        newPlaylist = self._getPlaylist()

        # If we reach here, there is a change of some sort
        if newPlaylist is not None:
            # Update the playlist with any settings such as random start time
            self._updatePlaylistForSettings(newPlaylist)

            # Start playing the new file, just override the existing one that is playing
            self.player.play(newPlaylist)

            # Also update the overlay
            self._setOverlayImage()

            # Now set the repeat option
            self._setRepeat()

            # Update any settings that need to be done after the video is playing
            self._updatePostPlayingForSettings(newPlaylist)
开发者ID:robwebset,项目名称:screensaver.video,代码行数:29,代码来源:screensaver.py


示例3: _moveToThemeFolder

    def _moveToThemeFolder(self, directory):
        log("moveToThemeFolder: path = %s" % directory)

        # Handle the case where we have a disk image
        if (os_path_split(directory)[1] == 'VIDEO_TS') or (os_path_split(directory)[1] == 'BDMV'):
            directory = os_path_split(directory)[0]

        dirs, files = list_dir(directory)
        for aFile in files:
            m = re.search(Settings.getThemeFileRegEx(directory), aFile, re.IGNORECASE)
            if m:
                srcpath = os_path_join(directory, aFile)
                log("fetchAllMissingThemes: Found match: %s" % srcpath)
                targetpath = os_path_join(directory, Settings.getThemeDirectory())
                # Make sure the theme directory exists
                if not dir_exists(targetpath):
                    try:
                        xbmcvfs.mkdir(targetpath)
                    except:
                        log("fetchAllMissingThemes: Failed to create directory: %s" % targetpath, True, xbmc.LOGERROR)
                        break
                else:
                    log("moveToThemeFolder: directory already exists %s" % targetpath)
                # Add the filename to the path
                targetpath = os_path_join(targetpath, aFile)
                if not xbmcvfs.rename(srcpath, targetpath):
                    log("moveToThemeFolder: Failed to move file from %s to %s" % (srcpath, targetpath))
开发者ID:kodibrasil,项目名称:KodiBrasil,代码行数:27,代码来源:plugin.py


示例4: onInit

    def onInit(self):
        # Need to clear the list of the default items
        self.clearList()

        # Start by adding an option to Play All
        if len(self.files) > 0:
            anItem = xbmcgui.ListItem(ADDON.getLocalizedString(32101), path=SourceDetails.getFilenameAndPath())
            # Get the first items fanart for the play all option
            anItem.setProperty("Fanart_Image", self.files[0].getFanArt())

            if SourceDetails.getTvShowTitle() != "":
                anItem.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})

            if SourceDetails.getTitle() != "":
                anItem.setInfo('video', {'Title': SourceDetails.getTitle()})

            self.addItem(anItem)

        # Check if we want to have YouTube Extra Support
        if Settings.isYouTubeSearchSupportEnabled():
            # Create the message to the YouTube Plugin
            li = xbmcgui.ListItem(ADDON.getLocalizedString(32116))
            # Need to set the title to get it in the header
            if SourceDetails.getTvShowTitle() != "":
                li.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})
            if SourceDetails.getTitle() != "":
                li.setInfo('video', {'Title': SourceDetails.getTitle()})

            li.setProperty("Fanart_Image", SourceDetails.getFanArt())
            li.setProperty("search", "/search/?q=%s+Extras" % urllib.quote_plus(SourceDetails.getTitle().encode('utf8')))
            self.addItem(li)

        # Check if we want to have Vimeo Extra Support
        if Settings.isVimeoSearchSupportEnabled():
            # Create the message to the Vimeo Plugin
            li = xbmcgui.ListItem(ADDON.getLocalizedString(32122))
            # Need to set the title to get it in the header
            if SourceDetails.getTvShowTitle() != "":
                li.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})
            if SourceDetails.getTitle() != "":
                li.setInfo('video', {'Title': SourceDetails.getTitle()})

            li.setProperty("Fanart_Image", SourceDetails.getFanArt())
            li.setProperty("search", "/search/?q=%s+Extras" % urllib.quote_plus(SourceDetails.getTitle().encode('utf8')))
            self.addItem(li)

        for anExtra in self.files:
            log("VideoExtrasWindow: filename: %s" % anExtra.getFilename())

            # Create the list item
            anItem = anExtra.createListItem(path=SourceDetails.getFilenameAndPath(), parentTitle=SourceDetails.getTitle(), tvShowTitle=SourceDetails.getTvShowTitle())

            self.addItem(anItem)

        # Before we return, set back the selected on screen item to the one just watched
        # This is in the case of a reload
        if self.lastRecordedListPosition > 0:
            self.setCurrentListPosition(self.lastRecordedListPosition)

        xbmcgui.WindowXML.onInit(self)
开发者ID:croneter,项目名称:script.videoextras,代码行数:60,代码来源:default.py


示例5: _setPluginList

    def _setPluginList(self):
        # Make the call to find out all the addons that are installed
        json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Addons.GetAddons", "params": { "type": "xbmc.python.pluginsource", "enabled": true, "properties": ["name", "thumbnail", "fanart"] }, "id": 1}')
        json_query = unicode(json_query, 'utf-8', errors='ignore')
        json_response = simplejson.loads(json_query)
        log(json_response)
        plugins = []
        if ("result" in json_response) and ('addons' in json_response['result']):
            # Check each of the plugins that are installed on the system
            for addonItem in json_response['result']['addons']:
                addonId = addonItem['addonid']
                # Need to skip ourselves
                if addonId in ['script.pinsentry']:
                    log("setPluginList: Skipping PinSentry Plugin")
                    continue

                pluginDetails = {}
                pluginDetails['title'] = addonItem['name']
                pluginDetails['dbid'] = addonId

                if addonItem['thumbnail'] in [None, ""]:
                    pluginDetails['thumbnail'] = 'DefaultAddon.png'
                else:
                    pluginDetails['thumbnail'] = addonItem['thumbnail']

                if addonItem['fanart'] in [None, ""]:
                    pluginDetails['fanart'] = FANART
                else:
                    pluginDetails['fanart'] = addonItem['fanart']

                plugins.append(pluginDetails)
        return plugins
开发者ID:EPiC-APOC,项目名称:repository.xvbmc,代码行数:32,代码来源:plugin.py


示例6: _setRepositoryList

    def _setRepositoryList(self):
        # Make the call to find out all the addons that are installed
        json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Addons.GetAddons", "params": { "type": "xbmc.addon.repository", "properties": ["name", "thumbnail", "fanart"] }, "id": 1}')
        json_query = unicode(json_query, 'utf-8', errors='ignore')
        json_response = simplejson.loads(json_query)
        log(json_response)
        repos = []
        if ("result" in json_response) and ('addons' in json_response['result']):
            # Check each of the repos that are installed on the system
            for addonItem in json_response['result']['addons']:
                addonId = addonItem['addonid']

                pluginDetails = {}
                pluginDetails['title'] = addonItem['name']
                pluginDetails['dbid'] = addonId

                if addonItem['thumbnail'] in [None, ""]:
                    pluginDetails['thumbnail'] = 'DefaultAddon.png'
                else:
                    pluginDetails['thumbnail'] = addonItem['thumbnail']

                if addonItem['fanart'] in [None, ""]:
                    pluginDetails['fanart'] = FANART
                else:
                    pluginDetails['fanart'] = addonItem['fanart']

                repos.append(pluginDetails)
        return repos
开发者ID:amadu80,项目名称:repository.xvbmc,代码行数:28,代码来源:plugin.py


示例7: _enableKeymap

 def _enableKeymap(self):
     try:
         xbmcvfs.copy(self.KEYMAPSOURCEFILE, self.KEYMAPDESTFILE)
         xbmc.executebuiltin('Action(reloadkeymaps)')
         log("SonosVolumeRedirect: Installed custom keymap")
     except:
         log("SonosVolumeRedirect: Failed to copy & load custom keymap: %s" % traceback.format_exc(), xbmc.LOGERROR)
开发者ID:robwebset,项目名称:script.sonos,代码行数:7,代码来源:service.py


示例8: _addSecurityFlags

    def _addSecurityFlags(self, type, items):
        # Make sure we have some items to append the details to
        if len(items) < 1:
            return items

        # Make the call to the DB to get all the specific security settings
        pinDB = PinSentryDB()

        securityDetails = {}
        if type == MenuNavigator.TVSHOWS:
            securityDetails = pinDB.getAllTvShowsSecurity()
        elif type == MenuNavigator.MOVIES:
            securityDetails = pinDB.getAllMoviesSecurity()
        elif type == MenuNavigator.MOVIESETS:
            securityDetails = pinDB.getAllMovieSetsSecurity()
        elif type == MenuNavigator.MUSICVIDEOS:
            securityDetails = pinDB.getAllMusicVideosSecurity()
        elif type == MenuNavigator.PLUGINS:
            securityDetails = pinDB.getAllPluginsSecurity()
        elif type == MenuNavigator.FILESOURCE:
            securityDetails = pinDB.getAllFileSourcesSecurity()

        for item in items:
            # Default security to 0 (Not Set)
            securityLevel = 0
            if item['title'] in securityDetails:
                title = item['title']
                securityLevel = securityDetails[title]
                log("PinSentryPlugin: %s has security level %d" % (title, securityLevel))

            item['securityLevel'] = securityLevel

        del pinDB
        return items
开发者ID:EPiC-APOC,项目名称:repository.xvbmc,代码行数:34,代码来源:plugin.py


示例9: runArtistSlideshow

 def runArtistSlideshow(self):
     log("SonosArtistSlideshow: runArtistSlideshow")
     # startup artistslideshow
     xbmcgui.Window(self.windowId).setProperty("ArtistSlideshow.ExternalCall", "True")
     # assumes addon is using suggested infolabel name of CURRENTARTIST and CURRENTTITLE
     artistslideshow = "RunScript(script.artistslideshow,windowid=%s&artistfield=%s&titlefield=%s&albumfield=%s&mbidfield=%s)" % (xbmcgui.getCurrentWindowId(), "CURRENTARTIST", "CURRENTTITLE", "CURRENTALBUM", "CURRENTMBID")
     xbmc.executebuiltin(artistslideshow)
开发者ID:robwebset,项目名称:script.sonos,代码行数:7,代码来源:default.py


示例10: _getAllFilesInDirectory

    def _getAllFilesInDirectory(self, baseDir, includeSubDirs=True):
        videoFiles = []
        dirs, files = list_dir(baseDir)

        # Get the list of files that are to be excluded
        collectionCtrl = CollectSets()
        disabledVideos = collectionCtrl.getDisabledVideos()
        del collectionCtrl

        # Get all the files in the current directory
        for vidFile in files:
            # Check if this file is excluded
            if vidFile in disabledVideos:
                log("Ignoring disabled screensaver video %s" % vidFile)
                continue

            fullPath = os_path_join(baseDir, vidFile)
            videoFiles.append(fullPath)

        # Now check each directory
        if includeSubDirs and Settings.isFolderNested():
            for aDir in dirs:
                fullPath = os_path_join(baseDir, aDir)
                dirContents = self._getAllFilesInDirectory(fullPath)
                videoFiles = videoFiles + dirContents

        return videoFiles
开发者ID:robwebset,项目名称:screensaver.video,代码行数:27,代码来源:screensaver.py


示例11: isClose

    def isClose(self):
        # Check if the base class has detected a need to close
        needToClose = SonosControllerWindow.isClose(self)

        # There are cases where the user could have changed the screen being
        # displayed, for example, if they have the following in their keymap:
        #   <keymap>
        #     <global>
        #       <keyboard>
        #         <f5>ActivateWindow(0)</f5>
        #       </keyboard>
        #     </global>
        #   </keymap>
        # This could cause a change in window, such as loading the home screen
        # however we do not get a call to close - as the Sonos window will be
        # still running in the back-ground - just not showing on the screen
        # If the user then exits, the keymap file will be left, so we will
        # automatically close the window in this case
        # Note: This is not an issue with the normal controller - as it is a
        # dialog window, so will always remain in view
        if (not needToClose) and (self.windowId != -1):
            # Get the current window
            showingWindowId = xbmcgui.getCurrentWindowId()
            # Check if the window is no longer showing
            if showingWindowId != self.windowId:
                log("SonosArtistSlideshow: Detected change in window, sonos window = %d, new window = %d" % (self.windowId, showingWindowId))
                return True

        return needToClose
开发者ID:robwebset,项目名称:script.sonos,代码行数:29,代码来源:default.py


示例12: removeCollection

    def removeCollection(self, name, link):
        if name in [None, ""]:
            return

        collectionCtrl = CollectSets()
        collectionDetails = collectionCtrl.loadCollection(link)

        filesToDelete = []
        # If the file was not processed just don't display anything
        if collectionDetails not in [None, ""]:
            screensaverFolder = Settings.getScreensaverFolder()

            for videoItem in collectionDetails['videos']:
                # If theme exists we need to check if we want to delete it
                if screensaverFolder not in [None, ""]:
                    videoLocation = os_path_join(screensaverFolder, videoItem['filename'])

                    log("VideoScreensaverPlugin: Checking if %s already downloaded to %s" % (videoItem['filename'], videoLocation))
                    if xbmcvfs.exists(videoLocation):
                        filesToDelete.append(videoLocation)

        # If there are possible files to delete, then prompt the user to see if we should
        if len(filesToDelete) > 0:
            needDelete = xbmcgui.Dialog().yesno(ADDON.getLocalizedString(32005), ADDON.getLocalizedString(32086))

            if needDelete:
                for vidFile in filesToDelete:
                    xbmcvfs.delete(vidFile)

        # Now remove the actual collection
        collectionCtrl.removeCustomCollection(name)
        del collectionCtrl

        # Now reload the screen to reflect the change
        xbmc.executebuiltin("Container.Refresh")
开发者ID:one9howard,项目名称:screensaver.video,代码行数:35,代码来源:plugin.py


示例13: _getSecondsInTimeString

    def _getSecondsInTimeString(self, fullTimeString):
        # Some services do not support duration
        if fullTimeString == 'NOT_IMPLEMENTED':
            return -1

        # Start by splitting the time into sections
        hours = 0
        minutes = 0
        seconds = 0

        try:
            hours = int(fullTimeString.split(':', 1)[0])
            minutes = int(fullTimeString.split(':')[1])
            seconds = int(fullTimeString.split(':')[2])
        except:
            # time sections are not numbers
            log("SonosControllerWindow: Exception Details: %s" % traceback.format_exc())
            hours = 0
            minutes = 0
            seconds = 0

        totalInSeconds = (((hours * 60) + minutes) * 60) + seconds
        log("SonosControllerWindow: Time %s, splits into hours=%d, minutes=%d, seconds=%d, total=%d" % (fullTimeString, hours, minutes, seconds, totalInSeconds))

        # Return the total time in seconds
        return totalInSeconds
开发者ID:robwebset,项目名称:script.sonos,代码行数:26,代码来源:default.py


示例14: fetchTheme

    def fetchTheme(self, title, path, originaltitle=None, isTvShow=None, year=None, imdb=None):
        # If there is already a theme then start playing it
        self._startPlayingExistingTheme(path)

        if Settings.isThemeDirEnabled() and self._doesThemeExist(path, True):
            # Prompt user if we should move themes in the parent
            # directory into the theme directory
            moveExistingThemes = xbmcgui.Dialog().yesno(ADDON.getLocalizedString(32105), ADDON.getLocalizedString(32206), ADDON.getLocalizedString(32207))

            # Check if we need to move a theme file
            if moveExistingThemes:
                log("fetchAllMissingThemes: Moving theme for %s" % title)
                self._moveToThemeFolder(path)
                # Stop playing any theme that started
                self._stopPlayingTheme()
                # Now reload the screen to reflect the change
                xbmc.executebuiltin("Container.Refresh")
                return

        if originaltitle is not None:
            originaltitle = normalize_string(originaltitle)

        # Perform the fetch
        videoList = []
        normtitle = normalize_string(title)
        videoItem = {'title': normtitle, 'path': path, 'originalTitle': originaltitle, 'isTvShow': isTvShow, 'year': year, 'imdb': imdb}
        videoList.append(videoItem)
        TvTunesFetcher(videoList)

        # Stop playing any theme that started
        self._stopPlayingTheme()

        # Now reload the screen to reflect the change
        xbmc.executebuiltin("Container.Refresh")
开发者ID:kodibrasil,项目名称:KodiBrasil,代码行数:34,代码来源:plugin.py


示例15: editPlot

    def editPlot(self, target, path, filename):
        # Create the extras class that will be used to process the extras
        videoExtras = VideoExtrasBase(path, target)

        # Perform the search command
        # We are only updating the NFO for an entry already shown, no need for fanart
        files = videoExtras.findExtras()
        del videoExtras

        for anExtra in files:
            if anExtra.isFilenameMatch(filename):
                log("MenuNavigator: Found  = %s" % filename)

                # Prompt the user for the new name
                keyboard = xbmc.Keyboard()
                keyboard.setDefault(anExtra.getPlot())
                keyboard.doModal()

                if keyboard.isConfirmed():
                    try:
                        newplot = keyboard.getText().decode("utf-8")
                    except:
                        newplot = keyboard.getText()

                    # Only set the title if it has changed
                    if (newplot != anExtra.getPlot()) and ((len(newplot) > 0) or (anExtra.getPlot() is not None)):
                        isTv = (target == MenuNavigator.TVSHOWS)
                        result = anExtra.setPlot(newplot, isTV=isTv)
                        if not result:
                            xbmcgui.Dialog().ok(ADDON.getLocalizedString(32102), ADDON.getLocalizedString(32115))
                        else:
                            # Update the display
                            xbmc.executebuiltin("Container.Refresh")
开发者ID:croneter,项目名称:script.videoextras,代码行数:33,代码来源:plugin.py


示例16: hasVideoExtras

    def hasVideoExtras(self, target, dbid, file, title=None):
        # If the service is on, then we can just check to see if the overlay image exists
        if Settings.isServiceEnabled():
            # Get the path where the file exists
            rootPath = os_path_join(PROFILE_DIR, target)
            if not dir_exists(rootPath):
                # Directory does not exist yet, so can't have extras
                return False

            # Generate the name of the file that the overlay will be copied to
            targetFile = os_path_join(rootPath, ("%d.png" % dbid))
            if xbmcvfs.exists(targetFile):
                return True

        # Otherwise, need to do the lookup the old fashioned way of looking for the
        # extras files on the file system (This is much slower)
        else:
            videoExtras = VideoExtrasBase(file, target, title)
            # We are only checking for existence of extras, no need for fanart
            firstExtraFile = videoExtras.findExtras(True)
            del videoExtras
            if firstExtraFile:
                log("MenuNavigator: Extras found for (%d) %s" % (dbid, file))
                return True

        return False
开发者ID:croneter,项目名称:script.videoextras,代码行数:26,代码来源:plugin.py


示例17: enable

 def enable(self):
     try:
         xbmcvfs.copy(self.KEYMAPSOURCEFILE, self.KEYMAPDESTFILE)
         self.keymapCopied = True
         xbmc.executebuiltin('Action(reloadkeymaps)')
         log("KeyMaps: Installed custom keymap")
     except:
         log("KeyMaps: Failed to copy & load custom keymap: %s" % traceback.format_exc(), xbmc.LOGERROR)
开发者ID:robwebset,项目名称:script.sonos,代码行数:8,代码来源:default.py


示例18: clear

    def clear(self, fullpath):
        log("AudioBooksPlugin: Clearing history for %s" % fullpath)
        # Remove the item from the database, it will then be rescanned
        audiobookDB = AudioBooksDB()
        audiobookDB.deleteAudioBook(fullpath)
        del audiobookDB

        xbmc.executebuiltin("Container.Refresh")
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:8,代码来源:plugin.py


示例19: onInit

    def onInit(self):
        xbmcgui.WindowXML.onInit(self)

        # Set the value of the dimming for the video
        dimLevel = Settings.getDimValue()
        if dimLevel is not None:
            log("WeatherScreen: Setting Dim Level to: %s" % dimLevel)
            dimControl = self.getControl(WeatherScreen.DIM_CONTROL)
            dimControl.setColorDiffuse(dimLevel)
开发者ID:robwebset,项目名称:screensaver.weather,代码行数:9,代码来源:monitor.py


示例20: _convertTimeToMinutes

 def _convertTimeToMinutes(self, strTime):
     if strTime in [None, ""]:
         log("Schedule: Time not set")
         return None
     strTimeSplit = strTime.split(':')
     if len(strTimeSplit) < 2:
         log("Schedule: Incorrect time format: %s" % strTime)
         return None
     return (int(strTimeSplit[0]) * 60) + int(strTimeSplit[1])
开发者ID:robwebset,项目名称:screensaver.video,代码行数:9,代码来源:screensaver.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python settings.Settings类代码示例发布时间:2022-05-26
下一篇:
Python resolvers.request函数代码示例发布时间: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