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

Python settings.os_path_join函数代码示例

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

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



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

示例1: _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


示例2: _doesThemeExist

    def _doesThemeExist(self, directory):
        log("doesThemeExist: Checking directory: %s" % directory)
        # Check for custom theme directory
        if Settings.isThemeDirEnabled():
            themeDir = os_path_join(directory, Settings.getThemeDirectory())
            # Check if this directory exists
            if not dir_exists(themeDir):
                workingPath = directory
                # If the path currently ends in the directory separator
                # then we need to clear an extra one
                if (workingPath[-1] == os.sep) or (workingPath[-1] == os.altsep):
                    workingPath = workingPath[:-1]
                # If not check to see if we have a DVD VOB
                if (os_path_split(workingPath)[1] == 'VIDEO_TS') or (os_path_split(workingPath)[1] == 'BDMV'):
                    # Check the parent of the DVD Dir
                    themeDir = os_path_split(workingPath)[0]
                    themeDir = os_path_join(themeDir, Settings.getThemeDirectory())
            directory = themeDir

        # check if the directory exists before searching
        if dir_exists(directory):
            # Generate the regex
            themeFileRegEx = Settings.getThemeFileRegEx(audioOnly=True)

            dirs, files = list_dir(directory)
            for aFile in files:
                m = re.search(themeFileRegEx, aFile, re.IGNORECASE)
                if m:
                    log("doesThemeExist: Found match: " + aFile)
                    return True
        return False
开发者ID:angelblue05,项目名称:script.tvtunes,代码行数:31,代码来源:scraper.py


示例3: getPlatformLibFiles

    def getPlatformLibFiles(parentDir):
        if parentDir in [None, ""]:
            return None

        log("FFMpegLib: Looking for libraries in %s" % parentDir)
        libLocation = {}

        # Check if the directory exists
        if dir_exists(parentDir):
            # List the contents of the directory
            dirs, files = xbmcvfs.listdir(parentDir)
            for aFile in files:
                if 'avutil' in aFile:
                    libLocation['avutil'] = os_path_join(parentDir, aFile)
                    log("FFMpegLib: Found avutil library: %s" % libLocation['avutil'])
                elif 'swresample' in aFile:
                    libLocation['swresample'] = os_path_join(parentDir, aFile)
                    log("FFMpegLib: Found swresample library: %s" % libLocation['swresample'])
                elif 'avcodec' in aFile:
                    libLocation['avcodec'] = os_path_join(parentDir, aFile)
                    log("FFMpegLib: Found avcodec library: %s" % libLocation['avcodec'])
                elif 'avformat' in aFile:
                    libLocation['avformat'] = os_path_join(parentDir, aFile)
                    log("FFMpegLib: Found avformat library: %s" % libLocation['avformat'])
        else:
            log("FFMpegLib: Directory not found %s" % parentDir)

        # Make sure we found all of the libraries
        if len(libLocation) < 4:
            return None

        return libLocation
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:32,代码来源:ffmpegLib.py


示例4: __init__

    def __init__(self):
        addonRootDir = xbmc.translatePath("special://profile/addon_data/%s" % __addonid__).decode("utf-8")
        self.tempDir = os_path_join(addonRootDir, "temp")
        self.videoDir = os_path_join(addonRootDir, "videos")

        # Set up the addon directories if they do not already exist
        if not dir_exists(addonRootDir):
            xbmcvfs.mkdir(addonRootDir)
        if not dir_exists(self.tempDir):
            xbmcvfs.mkdir(self.tempDir)
        if not dir_exists(self.videoDir):
            xbmcvfs.mkdir(self.videoDir)
开发者ID:TonyPh12345,项目名称:kodibrasilforum,代码行数:12,代码来源:downloader.py


示例5: _loadImages

    def _loadImages(self, filename):
        imageList = []
        # Find out the name of the image files
        fileNoExt = os.path.splitext(filename)[0]

        # Start by searching for the filename match
        fileNoExtImage = self._loadImageFile(fileNoExt)
        if fileNoExtImage != "":
            imageList.append(fileNoExtImage)

        # Check for -poster added to the end
        fileNoExtImage = self._loadImageFile(fileNoExt + "-poster")
        if fileNoExtImage != "":
            imageList.append(fileNoExtImage)

        if len(imageList) < 2:
            # Check for -thumb added to the end
            fileNoExtImage = self._loadImageFile(fileNoExt + "-thumb")
            if fileNoExtImage != "":
                imageList.append(fileNoExtImage)

        if len(imageList) < 2:
            # Check for poster.jpg
            fileDir = os_path_join(self.directory, "poster")
            fileNoExtImage = self._loadImageFile(fileDir)
            if fileNoExtImage != "":
                imageList.append(fileNoExtImage)

        if len(imageList) < 2:
            # Check for folder.jpg
            fileDir = os_path_join(self.directory, "folder")
            fileNoExtImage = self._loadImageFile(fileDir)
            if fileNoExtImage != "":
                imageList.append(fileNoExtImage)

        # Set the first one to the thumbnail, and the second the the icon
        if len(imageList) > 0:
            self.thumbnailImage = imageList[0]
            if len(imageList) > 1:
                self.iconImage = imageList[1]

        # Now check for the fanart
        # Check for -fanart added to the end
        fileNoExtImage = self._loadImageFile(fileNoExt + "-fanart")
        if fileNoExtImage != "":
            self.fanart = fileNoExtImage
        else:
            # Check for fanart.jpg
            fileDir = os_path_join(self.directory, "fanart")
            fileNoExtImage = self._loadImageFile(fileDir)
            if fileNoExtImage != "":
                self.fanart = fileNoExtImage
开发者ID:robwebset,项目名称:script.videoextras,代码行数:52,代码来源:ExtrasItem.py


示例6: __init__

    def __init__(self):
        addonRootDir = xbmc.translatePath('special://profile/addon_data/%s' % __addonid__).decode("utf-8")
        self.tempDir = os_path_join(addonRootDir, 'temp')
        self.videoDir = os_path_join(addonRootDir, 'videos')
        self.ziggyServer = "aHR0cDovL2tvZGkuemlnZ3k3MzcwMS5zZWVkci5pby9WaWRlb1NjcmVlbnNhdmVyLw=="

        # Set up the addon directories if they do not already exist
        if not dir_exists(addonRootDir):
            xbmcvfs.mkdir(addonRootDir)
        if not dir_exists(self.tempDir):
            xbmcvfs.mkdir(self.tempDir)
        if not dir_exists(self.videoDir):
            xbmcvfs.mkdir(self.videoDir)
开发者ID:Zernable,项目名称:screensaver.video,代码行数:13,代码来源:downloader.py


示例7: _findCoverImage

    def _findCoverImage(self, dirPath):
        coverImages = []
        dirs, files = xbmcvfs.listdir(dirPath)

        for aFile in files:
            if aFile.startswith('cover') and (aFile.endswith('jpg') or aFile.endswith('jpeg') or aFile.endswith('png')):
                # Add this image to the list
                coverImages.append(os_path_join(dirPath, aFile))

        # Now check any of the directories
        for aDir in dirs:
            coverImages = coverImages + self._findCoverImage(os_path_join(dirPath, aDir))

        return coverImages
开发者ID:robwebset,项目名称:script.ebooks,代码行数:14,代码来源:ebook.py


示例8: _getExtrasDirFiles

    def _getExtrasDirFiles(self, basepath, exitOnFirst=False, noExtrasDirNeeded=False):
        # If a custom path, then don't looks for the Extras directory
        if noExtrasDirNeeded or Settings.isCustomPathEnabled():
            extrasDir = basepath
        else:
            # Add the name of the extras directory to the end of the path
            extrasDir = os_path_join(basepath, Settings.getExtrasDirName())
        log("VideoExtrasFinder: Checking existence for %s" % extrasDir)
        extras = []
        # Check if the extras directory exists
        if dir_exists(extrasDir):
            # list everything in the extras directory
            dirs, files = xbmcvfs.listdir(extrasDir)
            for filename in files:
                log("VideoExtrasFinder: found file: %s" % filename)
                # Check each file in the directory to see if it should be skipped
                if not self._shouldSkipFile(filename):
                    extrasFile = os_path_join(extrasDir, filename)
                    extraItem = ExtrasItem(extrasDir, extrasFile, extrasDb=self.extrasDb, defaultFanArt=self.defaultFanArt)
                    extras.append(extraItem)
                    # Check if we are only looking for the first entry
                    if exitOnFirst is True:
                        break
            # Now check all the directories in the "Extras" directory
            # Need to see if they contain a DVD image
            for dirName in dirs:
                log("VideoExtrasFinder: found directory: %s" % dirName)
                # Check each directory to see if it should be skipped
                if not self._shouldSkipFile(dirName):
                    extrasSubDir = os_path_join(extrasDir, dirName)
                    # Check to see if this sub-directory is a DVD directory by checking
                    # to see if there is VIDEO_TS directory
                    videoTSDir = os_path_join(extrasSubDir, 'VIDEO_TS')
                    # Also check for Bluray
                    videoBluRayDir = os_path_join(extrasSubDir, 'BDMV')
                    if dir_exists(videoTSDir) or dir_exists(videoBluRayDir):
                        extraItem = ExtrasItem(extrasDir, extrasSubDir, extrasDb=self.extrasDb, defaultFanArt=self.defaultFanArt)
                        extras.append(extraItem)
                    else:
                        # This is a sub directory inside the extras directory that is
                        # not a DVD image directory, so scan the contents of this as well
                        extras = extras + self._getExtrasDirFiles(extrasSubDir, exitOnFirst, True)

                    # Check if we are only looking for the first entry
                    if exitOnFirst is True:
                        break

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


示例9: __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


示例10: _getThemeFiles

    def _getThemeFiles(self, directory, extensionOnly=False):
        # First read from the NFO file if it exists
        nfoRead = NfoReader(directory, self.debug_logging_enabled)
        themeFiles = nfoRead.getThemeFiles()

        # Get the theme directories that are referenced and process the data in them
        for nfoDir in nfoRead.getThemeDirs():
            # Do not want the theme keyword if looking at an entire directory
            themeFiles = themeFiles + self._getThemeFiles(nfoDir, True)

        del nfoRead
        log("ThemeFiles: Searching %s for %s" % (directory, Settings.getThemeFileRegEx(directory, extensionOnly, self.audioOnly)), self.debug_logging_enabled)

        # check if the directory exists before searching
        if dir_exists(directory):
            dirs, files = list_dir(directory)
            for aFile in files:
                m = re.search(Settings.getThemeFileRegEx(directory, extensionOnly, self.audioOnly), aFile, re.IGNORECASE)
                if m:
                    path = os_path_join(directory, aFile)
                    log("ThemeFiles: Found match: %s" % path, self.debug_logging_enabled)
                    # Add the theme file to the list
                    themeFiles.append(path)

        return themeFiles
开发者ID:angelblue05,项目名称:script.tvtunes,代码行数:25,代码来源:themeFinder.py


示例11: _findBookFile

    def _findBookFile(self, dirPath, bookFileName):
        bookFile = None
        dirs, files = xbmcvfs.listdir(dirPath)

        for aFile in files:
            if aFile.lower() == bookFileName:
                # Found a match, set the value
                bookFile = os_path_join(dirPath, aFile)
                break

        # Now check any of the directories
        for aDir in dirs:
            if bookFile is None:
                bookFile = self._findBookFile(os_path_join(dirPath, aDir), bookFileName)

        return bookFile
开发者ID:robwebset,项目名称:script.ebooks,代码行数:16,代码来源:ebook.py


示例12: _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


示例13: __init__

 def __init__(self):
     # Start by getting the database location
     self.configPath = xbmc.translatePath(__addon__.getAddonInfo('profile'))
     self.databasefile = os_path_join(self.configPath, "pinsentry_database.db")
     log("PinSentryDB: Database file location = %s" % self.databasefile)
     # Make sure that the database exists if this is the first time
     self.createDatabase()
开发者ID:ryanjrose,项目名称:sualfreds-repo,代码行数:7,代码来源:database.py


示例14: _getMainCoverLocation

    def _getMainCoverLocation(self):
        coverFileName, oldExt = os.path.splitext(self.fileName)
        targetCoverName = "%s.jpg" % coverFileName
        coverTargetName = os_path_join(Settings.getCoverCacheLocation(), targetCoverName)

        log("AudioBookHandler: Cached cover target location is %s" % coverTargetName)
        return coverTargetName
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:7,代码来源:audiobook.py


示例15: _getCachedCover

    def _getCachedCover(self, fileName):
        cachedCover = None
        # check if the directory exists before searching
        dirs, files = xbmcvfs.listdir(Settings.getCoverCacheLocation())
        for aFile in files:
            # Get the filename without extension
            coverSrc, ext = os.path.splitext(aFile)

            # Get the name that the cached cover will have been stored as
            targetSrc, bookExt = os.path.splitext(fileName)

            # Make sure both are utf-8 when comparing
            try:
                coverSrc = coverSrc.encode("utf-8")
            except:
                pass
            try:
                targetSrc = targetSrc.encode("utf-8")
            except:
                pass

            if targetSrc == coverSrc:
                cachedCover = os_path_join(Settings.getCoverCacheLocation(), aFile)
                log("AudioBookHandler: Cached cover found: %s" % cachedCover)

        return cachedCover
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:26,代码来源:audiobook.py


示例16: _findTocNcx

    def _findTocNcx(self, dirPath):
        tocNcx = None
        dirs, files = xbmcvfs.listdir(dirPath)

        for aFile in files:
            if aFile.lower() == 'toc.ncx':
                # Found the table of contents file
                tocNcx = os_path_join(dirPath, aFile)
                break

        # Now check any of the directories
        for aDir in dirs:
            if tocNcx is None:
                tocNcx = self._findTocNcx(os_path_join(dirPath, aDir))

        return tocNcx
开发者ID:robwebset,项目名称:script.ebooks,代码行数:16,代码来源:ebook.py


示例17: __init__

 def __init__(self):
     # Start by getting the database location
     self.configPath = xbmc.translatePath(ADDON.getAddonInfo('profile'))
     self.databasefile = os_path_join(self.configPath, "ebooks_database.db")
     log("EbooksDB: Database file location = %s" % self.databasefile)
     # Check to make sure the DB has been created
     self._createDatabase()
开发者ID:robwebset,项目名称:script.ebooks,代码行数:7,代码来源:database.py


示例18: _getExistingCoverImage

    def _getExistingCoverImage(self):
        # Check if there is a cached version, or a local one on the drive
        fullpathLocalImage, bookExt = os.path.splitext(self.filePath)

        # Store the directory that the file is in, default the the current path
        parentPath = self.filePath

        # Check to see if this is actually a file with an extension
        if (bookExt not in [None, ""]) and (len(bookExt) < 5):
            fullpathLocalImage1 = "%s.jpg" % fullpathLocalImage
            fullpathLocalImage2 = "%s.JPG" % fullpathLocalImage

            if xbmcvfs.exists(fullpathLocalImage1):
                log("AudioBookHandler: Found local cached image %s" % fullpathLocalImage1)
                return fullpathLocalImage1
            if xbmcvfs.exists(fullpathLocalImage2):
                log("AudioBookHandler: Found local cached image %s" % fullpathLocalImage2)
                return fullpathLocalImage2

            # If we reach here, then we were a file, so get the directory part
            parentPath = (os_path_split(self.filePath))[0]

        # Check for a file in the same directory but with the name
        # "cover.jpg" or "folder.jpg
        dirs, files = xbmcvfs.listdir(parentPath)
        for file in files:
            if file.lower() in ['folder.jpg', 'cover.jpg']:
                fullpathLocalImage = os_path_join(parentPath, file)
                log("AudioBookHandler: Found local directory cover %s" % fullpathLocalImage)
                return fullpathLocalImage

        # Check for a cached cover
        return self._getCachedCover(self.fileName)
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:33,代码来源:audiobook.py


示例19: loadSavedPhrases

    def loadSavedPhrases(self):
        # Get the location of the speech list file
        configPath = xbmc.translatePath(__addon__.getAddonInfo('profile'))
        speechfile = os_path_join(configPath, "speech.txt")
        log("Speech: Phrases file location = %s" % speechfile)

        phrases = []
        # Check to see if the speech list file exists
        if not xbmcvfs.exists(speechfile):
            # Create a list of pre-defined phrases
            phrases.append(__addon__.getLocalizedString(32221))
            phrases.append(__addon__.getLocalizedString(32222))
            phrases.append(__addon__.getLocalizedString(32226))
            phrases.append('%greet')
            phrases.sort()
        else:
            # Read the phases from the file
            try:
                file_in = open(speechfile, 'r')
                phrases = file_in.readlines()
                file_in.close()
            except:
                log("Speech: Failed to read lines from file %s" % speechfile, xbmc.LOGERROR)
                log("Speech: %s" % traceback.format_exc(), xbmc.LOGERROR)

        return phrases
开发者ID:noba3,项目名称:KoTos,代码行数:26,代码来源:speech.py


示例20: _generateThemeFilelist

    def _generateThemeFilelist(self, rawPath):
        # Get the full path with any network alterations
        workingPath = self._getUsablePath(rawPath)

        themeList = self._getThemeFiles(workingPath)

        # If no themes have been found
        if len(themeList) < 1:
            # TV shows stored as ripped disc folders
            if ('VIDEO_TS' in workingPath) or ('BDMV' in workingPath):
                log("ThemeFiles: Found VIDEO_TS or BDMV in path: Correcting the path for DVDR tv shows", self.debug_logging_enabled)
                workingPath = os_path_split(workingPath)[0]
                themeList = self._getThemeFiles(workingPath)
                if len(themeList) < 1:
                    workingPath = os_path_split(workingPath)[0]
                    themeList = self._getThemeFiles(workingPath)
            else:
                # If no theme files were found in this path, look at the parent directory
                workingPath = os_path_split(workingPath)[0]

                # Check for the case where there is the theme forlder settings, we want to
                # check the parent folders themes directory
                if Settings.isThemeDirEnabled():
                    themeDir = os_path_join(workingPath, Settings.getThemeDirectory())
                    themeList = self._getThemeFiles(themeDir)

                # If there are still no themes, just check the parent directory
                if len(themeList) < 1:
                    themeList = self._getThemeFiles(workingPath)

        log("ThemeFiles: Playlist size = %d" % len(themeList), self.debug_logging_enabled)
        log("ThemeFiles: Working Path = %s" % workingPath, self.debug_logging_enabled)

        return themeList
开发者ID:nspierbundel,项目名称:OpenELEC.tv,代码行数:34,代码来源:themeFinder.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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