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
##
评论列表
文章目录