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


Python Settings.getCustomPath方法代码示例

本文整理汇总了Python中settings.Settings.getCustomPath方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.getCustomPath方法的具体用法?Python Settings.getCustomPath怎么用?Python Settings.getCustomPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在settings.Settings的用法示例。


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

示例1: __init__

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getCustomPath [as 别名]
    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,代码行数:36,代码来源:themeFinder.py

示例2: _getCustomPathDir

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getCustomPath [as 别名]
    def _getCustomPathDir(self, path):
        # Get the last element of the path
        pathLastDir = os_path_split(path)[1]

        # Create the path with this added
        custPath = Settings.getCustomPath(self.videoType)
        custPath = os_path_join(custPath, pathLastDir)
        log("VideoExtrasFinder: Checking existence of custom path %s" % custPath)

        # Check if this path exists
        if not dir_exists(custPath):
            # If it doesn't exist, check the path before that, this covers the
            # case where there is a TV Show with each season in it's own directory

            # Make sure we have enough elements to actually navigate back up the path
            if len(os_path_split((os_path_split(path)[0]))) < 2:
                log("VideoExtrasFinder: No parent directories to check %s" % path)
            else:
                path2ndLastDir = os_path_split((os_path_split(path)[0]))[1]
                custPath = Settings.getCustomPath(self.videoType)
                custPath = os_path_join(custPath, path2ndLastDir)
                custPath = os_path_join(custPath, pathLastDir)
                log("VideoExtrasFinder: Checking existence of custom path %s" % custPath)
                if not dir_exists(custPath):
                    # If it still does not exist then check just the 2nd to last path
                    custPath = Settings.getCustomPath(self.videoType)
                    custPath = os_path_join(custPath, path2ndLastDir)
                    log("VideoExtrasFinder: Checking existence of custom path %s" % custPath)

            if not dir_exists(custPath):
                # Some systems will store extras in the custom pass using the name
                # of the TV Show of Movie, so try that
                videoName = self.title
                if self.title in [None, ""]:
                    if self.videoType == Settings.TVSHOWS:
                        videoName = xbmc.getInfoLabel("ListItem.TVShowTitle")
                    else:
                        videoName = xbmc.getInfoLabel("ListItem.Title")
                videoName = normalize_string(videoName)
                # Now construct the path using the movie or TV show title
                custPath = Settings.getCustomPath(self.videoType)
                custPath = os_path_join(custPath, videoName)
                log("VideoExtrasFinder: Checking existence of custom path using title %s" % custPath)
                if not dir_exists(custPath):
                    custPath = None

        return custPath
开发者ID:robwebset,项目名称:script.videoextras,代码行数:49,代码来源:core.py

示例3: getPathForVideoItem

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getCustomPath [as 别名]
    def getPathForVideoItem(self, videoItem):
        path = ""
        # Get the path where the theme should be stored
        if Settings.isCustomPathEnabled():
            path = os_path_join(Settings.getCustomPath(), normalize_string(videoItem['title']))
        else:
            path = videoItem['file']
            # Handle stacked files that have a custom file name format
            if path.startswith("stack://"):
                path = path.replace("stack://", "").split(" , ", 1)[0]
            # Need to remove the filename from the end  as we just want the directory
            fileExt = os.path.splitext(path)[1]
            # If this is a file, then get it's parent directory
            if fileExt is not None and fileExt != "":
                path = os_path_split(path)[0]

        return path
开发者ID:angelblue05,项目名称:script.tvtunes,代码行数:19,代码来源:plugin.py

示例4: getThemes

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getCustomPath [as 别名]
    def getThemes(self):
        themePath = ""
        # Only need the theme path for videos
        if not WindowShowing.isMusicSection():
            # Check if the files are stored in a custom path
            if Settings.isCustomPathEnabled():
                if not WindowShowing.isMovies():
                    videotitle = xbmc.getInfoLabel("ListItem.TVShowTitle")
                else:
                    videotitle = xbmc.getInfoLabel("ListItem.Title")
                videotitle = normalize_string(videotitle)
                themePath = os_path_join(Settings.getCustomPath(), videotitle)

            # Looking at the TV Show information page
            elif WindowShowing.isMovieInformation() and (WindowShowing.isTvShowTitles() or WindowShowing.isTvShows()):
                themePath = xbmc.getInfoLabel("ListItem.FilenameAndPath")
            else:
                themePath = xbmc.getInfoLabel("ListItem.Path")

        # To try and reduce the amount of "noise" in the logging, where the
        # same check is logged again and again, we record if it has been
        # logged for this video, and then do not do it again until the
        # video changes and what we would print wound be different
        debug_logging_enabled = False

        # Only log if something is different from the last time we logged
        if self.lastLoggedThemePath != themePath:
            debug_logging_enabled = True
            self.lastLoggedThemePath = themePath

        log("TunesBackend: themePath = %s" % themePath, debug_logging_enabled)

        # Check if the selection is a Movie Set
        if WindowShowing.isMovieSet():
            movieSetMap = self._getMovieSetFileList()

            if Settings.isCustomPathEnabled():
                # Need to make the values part (the path) point to the custom path
                # rather than the video file
                for aKey in movieSetMap.keys():
                    videotitle = normalize_string(aKey)
                    movieSetMap[aKey] = os_path_join(Settings.getCustomPath(), videotitle)

            if len(movieSetMap) < 1:
                themefile = ThemeFiles("", debug_logging_enabled=debug_logging_enabled)
            else:
                themefile = ThemeFiles(themePath, movieSetMap.values(), debug_logging_enabled=debug_logging_enabled)

        # When the reference is into the database and not the file system
        # then don't return it
        elif themePath.startswith("videodb:"):
            # If in either the Tv Show List or the Movie list then
            # need to stop the theme is selecting the back button
            if WindowShowing.isMovies() or WindowShowing.isTvShowTitles():
                themefile = ThemeFiles("", debug_logging_enabled=debug_logging_enabled)
            else:
                # Load the previous theme
                themefile = self.newThemeFiles
        else:
            if WindowShowing.isMusicSection():
                themefile = MusicThemeFiles(debug_logging_enabled)
            else:
                themefile = ThemeFiles(themePath, debug_logging_enabled=debug_logging_enabled)

        return themefile
开发者ID:kodibrasil,项目名称:KodiBrasil,代码行数:67,代码来源:backend.py

示例5: getSoloVideo

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getCustomPath [as 别名]
    def getSoloVideo(self):
        log("getSoloVideo: solo mode")

        # Used to pass the name and path via the command line
        # This caused problems with non ascii characters, so now
        # we just look at the screen details
        # The solo option is only available from the info screen
        # Looking at the TV Show information page
        isTvShow = self._isTv()
        if isTvShow:
            videoName = xbmc.getInfoLabel("ListItem.TVShowTitle")
            log("getSoloVideo: TV Show detected %s" % videoName)
        else:
            videoName = xbmc.getInfoLabel("ListItem.Title")
            log("getSoloVideo: Movie detected %s" % videoName)

        # Now get the video path
        videoPath = None
        if xbmc.getCondVisibility("Window.IsVisible(movieinformation)") and isTvShow:
            videoPath = xbmc.getInfoLabel("ListItem.FilenameAndPath")
        if videoPath is None or videoPath == "":
            videoPath = xbmc.getInfoLabel("ListItem.Path")
        log("getSoloVideo: Video Path %s" % videoPath)

        # Check if there is an "Original Title Defines
        originalTitle = xbmc.getInfoLabel("ListItem.OriginalTitle")
        if (originalTitle is not None) and (originalTitle != ""):
            originalTitle = normalize_string(originalTitle)
        else:
            originalTitle = None

        normVideoName = normalize_string(videoName)
        log("getSoloVideo: videoName = %s" % normVideoName)

        # If the main title and the original title are the same
        # Then no need to use the original title
        if (originalTitle == normVideoName):
            originalTitle = None

        if Settings.isCustomPathEnabled():
            videoPath = os_path_join(Settings.getCustomPath(), normVideoName)
        else:
            log("getSoloVideo: Solo dir = %s" % videoPath)
            # Need to clean the path if we are going to store the file there
            # Handle stacked files that have a custom file name format
            if videoPath.startswith("stack://"):
                videoPath = videoPath.replace("stack://", "").split(" , ", 1)[0]
            # Need to remove the filename from the end  as we just want the directory
            # if not os.path.isdir(videoPath):
            fileExt = os.path.splitext(videoPath)[1]
            # If this is a file, then get it's parent directory
            if fileExt is not None and fileExt != "":
                videoPath = os.path.dirname(videoPath)

        log("getSoloVideo: videoPath = %s" % videoPath)

        # Now get the year and imdb number for the video
        year = xbmc.getInfoLabel("ListItem.Year")
        imdb = xbmc.getInfoLabel("ListItem.IMDBNumber")

        videoItem = {'title': normVideoName, 'path': videoPath, 'originalTitle': originalTitle, 'isTvShow': isTvShow, 'year': year, 'imdb': imdb}
        return videoItem
开发者ID:angelblue05,项目名称:script.tvtunes,代码行数:64,代码来源:scraper.py

示例6: getSoloVideo

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getCustomPath [as 别名]
    def getSoloVideo(self):
        log("getSoloVideo: solo mode")

        # Used to pass the name and path via the command line
        # This caused problems with non ascii characters, so now
        # we just look at the screen details
        # The solo option is only available from the info screen
        # Looking at the TV Show information page
        if WindowShowing.isTv():
            videoName = xbmc.getInfoLabel("ListItem.TVShowTitle")
            log("getSoloVideo: TV Show detected %s" % videoName)
        else:
            videoName = xbmc.getInfoLabel("ListItem.Title")
            log("getSoloVideo: Movie detected %s" % videoName)

        # Now get the video path
        videoPath = None
        if WindowShowing.isMovieInformation() and WindowShowing.isTv():
            videoPath = xbmc.getInfoLabel("ListItem.FilenameAndPath")
        if videoPath is None or videoPath == "":
            videoPath = xbmc.getInfoLabel("ListItem.Path")
        log("getSoloVideo: Video Path %s" % videoPath)

        # Check if there is an "Original Title Defines
        originalTitle = xbmc.getInfoLabel("ListItem.OriginalTitle")
        if (originalTitle is not None) and (originalTitle != ""):
            originalTitle = normalize_string(originalTitle)
        else:
            originalTitle = None

        normVideoName = normalize_string(videoName)
        log("getSoloVideo: videoName = %s" % normVideoName)

        # If the main title and the original title are the same
        # Then no need to use the original title
        if (originalTitle == normVideoName):
            originalTitle = None

        if Settings.isCustomPathEnabled():
            videoPath = os_path_join(Settings.getCustomPath(), normVideoName)
        else:
            log("getSoloVideo: Solo dir = %s" % videoPath)
            # Need to clean the path if we are going to store the file there
            # Handle stacked files that have a custom file name format
            if videoPath.startswith("stack://"):
                videoPath = videoPath.replace("stack://", "").split(" , ", 1)[0]
            # Need to remove the filename from the end  as we just want the directory
            # if not os.path.isdir(videoPath):
            fileExt = os.path.splitext(videoPath)[1]
            # If this is a file, then get it's parent directory
            if fileExt is not None and fileExt != "":
                videoPath = os.path.dirname(videoPath)

        log("getSoloVideo: videoPath = %s" % videoPath)

#         try:
#             decodedPath = videoPath.decode("utf-8")
#             videoPath = decodedPath
#         except:
#             pass

        return [normVideoName, videoPath, originalTitle]
开发者ID:nspierbundel,项目名称:OpenELEC.tv,代码行数:64,代码来源:tvtunes_scraper.py


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