当前位置: 首页>>代码示例>>Python>>正文


Python settings.log函数代码示例

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


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

示例1: __init__

    def __init__(self, rawPath, pathList=None, videotitle=None, debug_logging_enabled=True, audioOnly=False):
        self.debug_logging_enabled = debug_logging_enabled
        self.forceShuffle = False
        self.doNotShuffle = False
        self.audioOnly = audioOnly
        self.rawPath = rawPath
        if rawPath in [None, ""]:
            self.clear()
        else:
            # Check for the case where there is a custom path set so we need to use
            # the custom location rather than the rawPath
            if Settings.isCustomPathEnabled() and (videotitle not in [None, ""]):
                customRoot = Settings.getCustomPath()
                # Make sure that the path passed in has not already been converted
                if customRoot not in self.rawPath:
                    self.rawPath = os_path_join(customRoot, normalize_string(videotitle))
                    log("ThemeFiles: Setting custom path to %s" % self.rawPath, self.debug_logging_enabled)

            if (pathList is not None) and (len(pathList) > 0):
                self.themeFiles = []
                for aPath in pathList:
                    subThemeList = self._generateThemeFilelistWithDirs(aPath)
                    # add these files to the existing list
                    self.themeFiles = self._mergeThemeLists(self.themeFiles, subThemeList)
                # If we were given a list, then we should shuffle the themes
                # as we don't always want the first path playing first
                self.forceShuffle = True
            else:
                self.themeFiles = self._generateThemeFilelistWithDirs(self.rawPath)

        # Check if we need to handle the ordering for video themes
        if not audioOnly:
            self.doNotShuffle = self._filterForVideoThemesRule()
            self.forceShuffle = False
开发者ID:kodibrasil,项目名称:KodiBrasil,代码行数:34,代码来源:themeFinder.py

示例2: 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:noba3,项目名称:KoTos,代码行数:29,代码来源:default.py

示例3: stop

    def stop(self, immediate=False, fastFade=False):
        if self.isAlive:
            # If video is playing, check to see if it is a theme video
            if self.themePlayer.isPlayingTheme():
                if immediate:
                    log("TunesBackend: Stop playing")
                    self.themePlayer.stop()
                    while self.themePlayer.isPlaying():
                        xbmc.sleep(50)
                else:
                    log("TunesBackend: Ending playing")
                    self.themePlayer.endPlaying(fastFade)

            self.isAlive = False

            # If currently playing a video file, then we have been overridden,
            # and we need to restore all the settings, the player callbacks
            # will not be called, so just force it on stop
            self.themePlayer.restoreSettings()

        # Clear all the values stored
        self.newThemeFiles.clear()
        self.oldThemeFiles.clear()
        self.prevThemeFiles.clear()
        self.delayedStart.clear()
        # Clear the option used by other add-ons to work out if TvTunes is playing a theme
        xbmcgui.Window(10025).clearProperty("TvTunesIsRunning")
        # The following value is added for the Confluence skin to not show what is
        # currently playing, maybe change this name when we submit the pull request to
        # Confluence - new name: PlayingBackgroundMedia
        xbmcgui.Window(10025).clearProperty("TvTunesIsAlive")
        xbmcgui.Window(10025).clearProperty("PlayingBackgroundMedia")

        # Clear the Theme Player by resetting it
        self.themePlayer = ThemePlayer()
开发者ID:kodibrasil,项目名称:KodiBrasil,代码行数:35,代码来源:backend.py

示例4: getImdbId_from_tvdbId

    def getImdbId_from_tvdbId(self, tvdbId):
        # http://thetvdb.com/api/2B8557E0CBF7D720/series/75565/en.xml
        url = '%s/%s/series/%s/en.xml' % (self.tvdb_url_prefix, self.tvdb_api_key, tvdbId)
        resp_details = self._makeCall(url)

        imdbId = None
        # The response is XML
        if resp_details not in [None, ""]:
            try:
                respData = ET.ElementTree(ET.fromstring(resp_details))

                rootElement = respData.getroot()
                if rootElement not in [None, ""]:
                    if rootElement.tag == 'Data':
                        series = rootElement.findall('Series')
                        # Only want to process anything if there is just a single series
                        if (series not in [None, ""]) and (len(series) > 0):
                            # There should only be one series as we selected by Id
                            selectedSeries = series[0]

                            if selectedSeries not in [None, ""]:
                                imdbIdElem = selectedSeries.find('IMDB_ID')
                                if imdbIdElem not in [None, ""]:
                                    imdbId = imdbIdElem.text
                                    log("IdLookup: Found IMDB_ID = %s" % imdbId)
            except:
                log("IdLookup: Failed to process data %s: %s" % (resp_details, traceback.format_exc()))

        return imdbId
开发者ID:kodibrasil,项目名称:KodiBrasil,代码行数:29,代码来源:idLookup.py

示例5: _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:noba3,项目名称:KoTos,代码行数:26,代码来源:default.py

示例6: getSelection

    def getSelection(self, narrowSearch=True):
        # Generate the URL and get the page
        search_url = "http://www.kids-in-mind.com/cgi-bin/search/search.pl?q=%s"
        url = search_url % urllib.quote_plus(self.videoTitle)
        html = self._getHtmlSource(url)

        soup = BeautifulSoup(''.join(html))

        # findAll('p', {"style": "font-family: Verdana; font-size: 11px; line-height:19px"})
        searchResults = soup.findAll('p', {"start": "1"})

        searchMatches = []
        # Check each of the entries found
        for entries in searchResults:
            for link in entries.findAll('a'):
                # Get the link
                videoName = self._convertHtmlIntoKodiText(link.string)
                videoUrl = link['href']
                searchMatches.append({"name": videoName, "link": videoUrl})
                log("KidsInMindScraper: Initial Search Match: %s {%s}" % (videoName, videoUrl))

        # The kids in mind search can often return lots of entries that do not
        # contain the words in the requested video, so we can try and narrow it down
        if narrowSearch:
            searchMatches = self._narrowDownSearch(searchMatches)

        return searchMatches
开发者ID:robwebset,项目名称:script.suitability,代码行数:27,代码来源:scraper.py

示例7: getUnsupportedScreensavers

    def getUnsupportedScreensavers(screensavers):
        log("getUnsupportedScreensavers")

        # Ideally we would check each addon we have already identified using the Addons.GetAddonDetails
        # API, however that will only return the primary type, and we are actually looking for
        # the script option as just one of the supported types
        json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Addons.GetAddons", "params": { "type": "xbmc.python.script" }, "id": 1}')

        json_response = json.loads(json_query)

        scriptaddons = []
        # Extract the addon ids from the response
        if ("result" in json_response) and ('addons' in json_response['result']):
            # Check each of the screensavers that are installed on the system
            for addonItem in json_response['result']['addons']:
                addonName = addonItem['addonid']
                scriptaddons.append(addonName)

        # Now check each of the addons we have to see if they support being launched as a script
        unsupportedScreensavers = []
        for screensaverAddon in screensavers:
            if screensaverAddon not in scriptaddons:
                log("RandomScreensaver: Screensaver %s does not support launching as a script" % screensaverAddon)
                unsupportedScreensavers.append(screensaverAddon)

        return unsupportedScreensavers
开发者ID:robwebset,项目名称:screensaver.random,代码行数:26,代码来源:collector.py

示例8: refresh

    def refresh(self):
        # Check if there is anything to do for lyrics
        if not Settings.isLyricsInfoLayout() or (self.listControl is None):
            return

        if not self.hasLyrics():
            return

        timeLines = self.track['lyrics']

        cur_time = self.track['position_seconds']
        nums = self.listControl.size()
        pos = self.listControl.getSelectedPosition()
        # Make sure that we don't exceed the index
        if pos >= len(timeLines):
            log("Lyrics: Current Position exceeds number of entries")
            return

        # Check if we need to roll the lyrics backwards
        if (cur_time < timeLines[pos][0]):
            while ((pos > 0) and (timeLines[pos - 1][0] > cur_time)):
                pos = pos - 1
        else:
            # Going forwards
            while ((pos < nums - 1) and (timeLines[pos + 1][0] < cur_time)):
                pos = pos + 1
            # Now we have the correct position, but we want that to sit in the
            # middle of the dialog, so add on the offset
            if (pos + self.lyricListOffset > nums - 1):
                # As it's near the end - set the focus to the last one
                self.listControl.selectItem(nums - 1)
            else:
                self.listControl.selectItem(pos + self.lyricListOffset)
        self.listControl.selectItem(pos)
开发者ID:noba3,项目名称:KoTos,代码行数:34,代码来源:lyrics.py

示例9: 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:angelblue05,项目名称:script.tvtunes,代码行数:34,代码来源:plugin.py

示例10: _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:angelblue05,项目名称:script.tvtunes,代码行数:27,代码来源:plugin.py

示例11: endPlaying

    def endPlaying(self, fastFade=False, slowFade=False):
        if self.isPlayingAudio() and Settings.isFadeOut():
            cur_vol = self._getVolume()

            # Calculate how fast to fade the theme, this determines
            # the number of step to drop the volume in
            numSteps = 10
            if fastFade:
                numSteps = numSteps / 2
            elif slowFade:
                numSteps = numSteps * 4

            vol_step = cur_vol / numSteps
            # do not mute completely else the mute icon shows up
            for step in range(0, (numSteps - 1)):
                # If the system is going to be shut down then we need to reset
                # everything as quickly as possible
                if WindowShowing.isShutdownMenu() or xbmc.abortRequested:
                    log("ThemePlayer: Shutdown menu detected, cancelling fade out")
                    break
                vol = cur_vol - vol_step
                log("ThemePlayer: fadeOut_vol: %s" % str(vol))
                self._setVolume(vol)
                cur_vol = vol
                xbmc.sleep(200)
            # The final stop and reset of the settings will be done
            # outside of this "if"
        # Need to always stop by the end of this
        self.stop()
开发者ID:angelblue05,项目名称:script.tvtunes,代码行数:29,代码来源:themePlayer.py

示例12: __init__

    def __init__(self, extrasParent, videoType=None, title=None):
        log("VideoExtrasBase: Finding extras for %s" % extrasParent)
        self.videoType = videoType
        self.baseDirectory = extrasParent
        if self.baseDirectory.startswith("stack://"):
            self.baseDirectory = self.baseDirectory.split(" , ")[0]
            self.baseDirectory = self.baseDirectory.replace("stack://", "")
        # There is a problem if some-one is using windows shares with
        # \\SERVER\Name as when the addon gets called the first \ gets
        # removed, making an invalid path, so we add it back here
        elif self.baseDirectory.startswith("\\"):
            self.baseDirectory = "\\" + self.baseDirectory

        # Support special paths like smb:// means that we can not just call
        # os.path.isfile as it will return false even if it is a file
        # (A bit of a shame - but that's the way it is)
        fileExt = os.path.splitext(self.baseDirectory)[1]
        # If this is a file, then get it's parent directory
        if fileExt is not None and fileExt != "":
            self.baseDirectory = (os_path_split(self.baseDirectory))[0]
            self.filename = (os_path_split(extrasParent))[1]
        else:
            self.filename = None
        self.title = title
        log("VideoExtrasBase: Root directory: %s" % self.baseDirectory)
开发者ID:robwebset,项目名称:script.videoextras,代码行数:25,代码来源:core.py

示例13: _getNestedExtrasFiles

    def _getNestedExtrasFiles(self, basepath, filename, exitOnFirst=False, noExtrasDirNeeded=False):
        extras = []
        if dir_exists(basepath):
            dirs, files = xbmcvfs.listdir(basepath)
            for dirname in dirs:
                # Do not search inside Bluray or DVD images
                if (dirname == 'VIDEO_TS') or (dirname == 'BDMV'):
                    continue

                dirpath = os_path_join(basepath, dirname)
                log("VideoExtrasFinder: Nested check in directory: %s" % dirpath)
                if dirname != Settings.getExtrasDirName():
                    log("VideoExtrasFinder: Check directory: %s" % dirpath)
                    extras.extend(self._getExtrasDirFiles(dirpath, exitOnFirst, noExtrasDirNeeded))
                    # Check if we are only looking for the first entry
                    if files and (exitOnFirst is True):
                        break
                    extras.extend(self._getExtrasFiles(dirpath, filename, exitOnFirst))
                    # Check if we are only looking for the first entry
                    if files and (exitOnFirst is True):
                        break
                    extras.extend(self._getNestedExtrasFiles(dirpath, filename, exitOnFirst, noExtrasDirNeeded))
                    # Check if we are only looking for the first entry
                    if files and (exitOnFirst is True):
                        break
        return extras
开发者ID:robwebset,项目名称:script.videoextras,代码行数:26,代码来源:core.py

示例14: getDisabledVideos

    def getDisabledVideos(self):
        disabledVideos = []
        # Check if the disabled videos file exists
        if not xbmcvfs.exists(self.disabledVideosFile):
            log("CollectSets: No disabled videos file exists")
            return disabledVideos

        try:
            # Load the file as a string
            disabledVideosFileRef = xbmcvfs.File(self.disabledVideosFile, 'r')
            disabledVideosStr = disabledVideosFileRef.read()
            disabledVideosFileRef.close()

            disabledVideosElem = ET.ElementTree(ET.fromstring(disabledVideosStr))

            # Expected XML format:
            # <disabled_screensaver>
            #     <filename></filename>
            # </disabled_screensaver>

            # Get the videos that are in the disabled list
            for filenameItem in disabledVideosElem.getroot().findall('filename'):
                disabledFile = filenameItem.text

                log("CollectSets: Disabled video file: %s" % disabledFile)
                disabledVideos.append(disabledFile)
        except:
            log("CollectSets: Failed to read collection file %s" % self.disabledVideosFile, xbmc.LOGERROR)
            log("CollectSets: %s" % traceback.format_exc(), xbmc.LOGERROR)

        log("CollectSets: Number of disabled videos is %d" % len(disabledVideos))
        return disabledVideos
开发者ID:robwebset,项目名称:screensaver.video,代码行数:32,代码来源:collectSets.py

示例15: clearLyricRequest

 def clearLyricRequest(self):
     log("Lyrics: Clearing lyric request")
     # Clear the lyrics that were stored so that the lyrics addon does not keep looking
     xbmcgui.Window(10000).clearProperty('culrc.manual')
     xbmcgui.Window(10000).clearProperty('culrc.artist')
     xbmcgui.Window(10000).clearProperty('culrc.track')
     xbmcgui.Window(10000).clearProperty('culrc.lyrics')
开发者ID:noba3,项目名称:KoTos,代码行数:7,代码来源:lyrics.py


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