cache.py 文件源码

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

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

        if not constants.CONST.SRT:
            return

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

        #only makes sense to cache SRT if the cachePath exists
        if service.settings.cacheSRT and self.cachePath != '':
            cachePath = str(self.cachePath) + '/' + str(self.package.file.id)+'/'

            if not xbmcvfs.exists(cachePath):
                xbmcvfs.mkdirs(cachePath)
            srt = service.getSRT(self.package)
            if srt:
                for file in srt:
                    if not xbmcvfs.exists(str(cachePath) + str(file[0])):
                        service.downloadGeneralFile(file[1], str(cachePath) + str(file[0]))
                    self.srt.append(str(cachePath) + str(file[0]))

        #fetch SRT URLs but we won't cache the files
        else:
            srt = service.getSRT(self.package)
            if srt:
                for file in srt:
                    self.srt.append(str(file[1]) + '|' + service.getHeadersEncoded())

    ##
    #  set the CC for the video file
    ##
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号