cache.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Python-GoogleDrive-VideoStream 作者: ddurdle 项目源码 文件源码
def getFiles(self,service):

        if not constants.CONST.CACHE:
            return None

        #load cachePath if not already loaded
        if self.cachePath == '':
            self.cachePath = service.settings.cachePath

        localResolutions = []
        localFiles = []

        # no local cache, no local files to look for
        if self.cachePath == '':
            return (localResolutions,localFiles)

        cachePath = str(self.cachePath) + '/' + str(self.package.file.id) + '/'

        #workaround for this issue: https://github.com/xbmc/xbmc/pull/8531
        if xbmcvfs.exists(cachePath) or os.path.exists(cachePath):
            dirs,files = xbmcvfs.listdir(cachePath)
            for file in files:
                if '.stream.mp4' in file:
                    try:
                        resolutionFile = xbmcvfs.File(cachePath   + str(os.path.splitext(file)[0]) + '.resolution')
                        resolution = resolutionFile.read()
                        resolutionFile.close()
                    except:
                        resolution = file
                    localResolutions.append('offline - ' + str(resolution))
                    localFiles.append(str(cachePath) + str(file))

        return (localResolutions,localFiles)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号