def addSeasonToLibrary(seriesID, seriesTitle, seasonID):
seriesFolderName = (''.join(c for c in seriesTitle if c not in '/\\:?"*|<>')).strip(' .')
seriesDir = os.path.join(libraryFolderTV, seriesFolderName)
if not os.path.isdir(seriesDir):
xbmcvfs.mkdir(unicode(seriesDir).encode("iso-8859-1"))
content = getUnicodePage(urlMain+"/gp/product/"+seasonID)
matchSeason = re.compile('"seasonNumber":"(.+?)"', re.DOTALL).findall(content)
spl = content.split('href="'+urlMain+'/gp/product')
for i in range(1, len(spl), 1):
entry = spl[i]
match = re.compile('class="episode-title">(.+?)<', re.DOTALL).findall(entry)
if match:
title = match[0]
title = cleanTitle(title)
episodeNr = title[:title.find('.')]
title = title[title.find('.')+1:].strip()
match = re.compile('/(.+?)/', re.DOTALL).findall(entry)
episodeID = match[0]
if len(episodeNr) > 2:
episodeNr = ''.join(re.findall(r'\d+', episodeNr))
if len(episodeNr) == 1:
episodeNr = "0"+episodeNr
seasonNr = matchSeason[0]
if len(seasonNr) == 1:
seasonNr = "0"+seasonNr
filename = "S"+seasonNr+"E"+episodeNr+" - "+title+".strm"
filename = (''.join(c for c in filename if c not in '/\\:?"*|<>')).strip(' .')
print type(filename)
fh = xbmcvfs.File(unicode(os.path.join(seriesDir, filename)).encode('utf-8'), 'w')
fh.write(unicode('plugin://'+addonID+'/?mode=playVideo&url='+episodeID).encode("utf-8"))
fh.close()
if updateDB:
xbmc.executebuiltin('UpdateLibrary(video)')
default.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录