def showEpisodes(): oGui = cGui() oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') sUrl = oParams.getValue('sUrl') seasonNum = oParams.getValue('Season') sHtmlContent = __getHtmlContent(sUrl, sSecurityValue) sMovieTitle = __createMovieTitle(sHtmlContent) result = cParser().parse(sHtmlContent, '<div class="Grahpics">.*?<img src="([^"]+)"') thumbnail = URL_MAIN + str(result[1][0]) if result[0] else False aSeriesItems = parseSerieEpisodes(sHtmlContent, seasonNum) if not aSeriesItems[0]: return for item in aSeriesItems: oGuiElement = cGuiElement(item['title'], SITE_IDENTIFIER, 'showHosters') sShowTitle = sMovieTitle.split('(')[0].split('*')[0] oGuiElement.setThumbnail(thumbnail) oGuiElement.setMediaType('episode') oGuiElement.setSeason(item['season']) oGuiElement.setEpisode(item['episode']) oGuiElement.setTVShowTitle(sShowTitle) oParams.addParams({'sUrl': item['url'], 'episode': item['episode'], 'season': item['season']}) oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=len(aSeriesItems)) oGui.setView('episodes') oGui.setEndOfDirectory()
def showSeriesPage(oGui, sUrl, iPage, dupeCheck): oParams = ParameterHandler() sPattern = '<div class="box-container">.*?<a href="(.*?)".*?src="(.*?)".*?alt="(.*?)"' # request if int(iPage) == 1: sHtmlContent = __getHtmlContent(sUrl) else: sHtmlContent = __getHtmlContent(sUrl + str(iPage)) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: for link, img, title in aResult[1]: if title in dupeCheck: continue if 'movies' in oParams.getValue('mediaType'): guiElement = cGuiElement(title, SITE_IDENTIFIER, 'showMovie') else: guiElement = cGuiElement(title, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(img) oParams.addParams({'sUrl': link, 'Title': title}) oGui.addFolder(guiElement, oParams) dupeCheck.append(title) return dupeCheck
def parseMovieEntrySite(): oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') if (oParams.exist('sUrl')): sUrl = oParams.getValue('sUrl') # get movieEntrySite content sHtmlContent = __getHtmlContent(sUrl, sSecurityValue) sMovieTitle = __createMovieTitle(sHtmlContent) bIsSerie = __isSerie(sHtmlContent) if (bIsSerie): oGui = cGui() aSeriesItems = parseSerieSite(sHtmlContent) if (len(aSeriesItems) > 0): imdbID = oParams.getValue('imdbID') for item in aSeriesItems: oGuiElement = cGuiElement(item['title'], SITE_IDENTIFIER, 'showHosters') sShowTitle = sMovieTitle.split('(')[0].split('*')[0] oGuiElement.setMediaType('episode') #if META and imdbID: # oMetaget = metahandlers.MetaData() # meta = oMetaget.get_episode_meta(sShowTitle, imdbID, item['season'], item['episode']) # meta['TVShowTitle'] = sShowTitle # oGuiElement.setItemValues(meta) # oGuiElement.setThumbnail(meta['cover_url']) # oGuiElement.setFanart(meta['backdrop_url']) # oGuiElement.setTitle('%s %s' % (item['title'], meta['title'].encode('utf-8'))) oParams.addParams({'sUrl':item['url'], 'episode':item['episode'], 'season':item['season'], 'TvShowTitle':sShowTitle}) oGui.addFolder(oGuiElement, oParams, bIsFolder = False, iTotal = len(aSeriesItems)) oGui.setView('episodes') oGui.setEndOfDirectory() else: result = showHosters(sHtmlContent, sMovieTitle) return result
def parseMovieEntrySite(): oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') if (oParams.exist('sUrl')): sUrl = oParams.getValue('sUrl') # get movieEntrySite content sHtmlContent = __getHtmlContent(sUrl, sSecurityValue) sMovieTitle = __createMovieTitle(sHtmlContent) bIsSerie = __isSerie(sHtmlContent) if (bIsSerie): oGui = cGui() aSeriesItems = parseSerieSite(sHtmlContent) if (len(aSeriesItems) > 0): imdbID = oParams.getValue('imdbID') for item in aSeriesItems: oGuiElement = cGuiElement(item['title'], SITE_IDENTIFIER, 'showHosters') sShowTitle = sMovieTitle.split('(')[0].split('*')[0] oGuiElement.setMediaType('episode') oParams.addParams({'sUrl':item['url'], 'episode':item['episode'], 'season':item['season'], 'TvShowTitle':sShowTitle}) oGui.addFolder(oGuiElement, oParams, bIsFolder = False, iTotal = len(aSeriesItems)) oGui.setView('episodes') oGui.setEndOfDirectory() else: result = showHosters(sHtmlContent, sMovieTitle) return result
def showEpisodes(): oGui = cGui() oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') sUrl = oParams.getValue('sUrl') seasonNum = oParams.getValue('Season') sHtmlContent = __getHtmlContent(sUrl, sSecurityValue) sMovieTitle = __createMovieTitle(sHtmlContent) result = cParser().parse(sHtmlContent, '<div class="Grahpics">.*?<img src="([^"]+)"') thumbnail = URL_MAIN + str(result[1][0]) if result[0] else False aSeriesItems = parseSerieEpisodes(sHtmlContent, seasonNum) if not aSeriesItems[0]: return for item in aSeriesItems: oGuiElement = cGuiElement(item['title'], SITE_IDENTIFIER, 'showHosters') sShowTitle = sMovieTitle.split('(')[0].split('*')[0] oGuiElement.setThumbnail(thumbnail) oGuiElement.setMediaType('episode') oGuiElement.setSeason(item['season']) oGuiElement.setEpisode(item['episode']) oGuiElement.setTVShowTitle(sShowTitle) oParams.addParams({ 'sUrl': item['url'], 'episode': item['episode'], 'season': item['season'] }) oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=len(aSeriesItems)) oGui.setView('episodes') oGui.setEndOfDirectory()
def showSeries(): oGui = cGui() oParams = ParameterHandler() sChar = oParams.getValue('char') if sChar: sChar = sChar.lower() series = _getJsonContent("series") total = len(series) for serie in series: sTitle = serie["series"].encode('utf-8') if sChar: if sChar == '#': if sTitle[0].isalpha(): continue elif sTitle[0].lower() != sChar: continue if oParams.getValue('specific') == 'Season': guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'randomSeason') else: guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) # Load series description by iteration through the REST-Api (slow) #sDesc = _getJsonContent("series/%d/1" % int(serie['id'])) #guiElement.setDescription(sDesc['series']['description'].encode('utf-8')) #sStart = str(sDesc['series']['start']) #if sStart != 'None': # guiElement.setYear(int(sDesc['series']['start'])) oParams.addParams({'seriesID' : str(serie["id"]), 'Title' : sTitle}) oGui.addFolder(guiElement, oParams, iTotal = total) oGui.setView('tvshows') oGui.setEndOfDirectory()
def showSeries(): oGui = cGui() oParams = ParameterHandler() sUrl = URL_SERIES oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request(); sChar = oParams.getValue('char') if sChar: sChar = sChar.lower() series = json.loads(sHtmlContent) total = len(series) for serie in series: sTitle = serie["series"].encode('utf-8') if sChar: if sChar == '#': if sTitle[0].isalpha():continue elif sTitle[0].lower() != sChar: continue guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) oParams.addParams({'siteUrl' : URL_SERIES + '/' + str(serie["id"]), 'Title' : sTitle}) oGui.addFolder(guiElement, oParams, iTotal = total) oGui.setView('tvshows') oGui.setEndOfDirectory()
def __getMovies(oGui, sHtmlContent): oParams = ParameterHandler() sBlockPattern = '<div class="moviefilm">.*?href="(.*?)"(.*?)src="(.*?)".*?alt="(.*?)"' # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sBlockPattern) unescape = cUtil().unescape if aResult[0]: for link, span, img, title in aResult[1]: title = unescape(title.decode('utf-8')).encode('utf-8') # TODO: Looking for span isn't the best way, but the only difference I found if "span" not in span: if __isSeriesEverAvaiable(): url = __getSELink(link) if url: guiElement = cGuiElement(title, SERIESEVER_IDENTIFIER, 'showMovie') guiElement.setMediaType('movie') guiElement.setThumbnail(img) oParams.addParams({'sUrl': url}) oGui.addFolder(guiElement, oParams) else: guiElement = cGuiElement(title, SITE_IDENTIFIER, 'showHosters') guiElement.setMediaType('movie') guiElement.setThumbnail(img) oParams.addParams({'sUrl': link, 'Title': title}) oGui.addFolder(guiElement, oParams, bIsFolder=False)
def showSeries(): oGui = cGui() oParams = ParameterHandler() sChar = oParams.getValue('char') if sChar: sChar = sChar.lower() series = _getJsonContent("series") total = len(series) for serie in series: sTitle = serie["series"].encode('utf-8') if sChar: if sChar == '#': if sTitle[0].isalpha(): continue elif sTitle[0].lower() != sChar: continue if oParams.getValue('specific') == 'Season': guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'randomSeason') else: guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) # Load series description by iteration through the REST-Api (slow) #sDesc = _getJsonContent("series/%d/1" % int(serie['id'])) #guiElement.setDescription(sDesc['series']['description'].encode('utf-8')) #sStart = str(sDesc['series']['start']) #if sStart != 'None': # guiElement.setYear(int(sDesc['series']['start'])) oParams.addParams({'seriesID': str(serie["id"]), 'Title': sTitle}) oGui.addFolder(guiElement, oParams, iTotal=total) oGui.setView('tvshows') oGui.setEndOfDirectory()
def showGenres(): oGui = cGui() oParams = ParameterHandler() sGenre = oParams.getValue('genreID') genres = _getJsonContent("series:genre") if not genres: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return total = len(genres) for genre in sorted(genres): genreID = str(genres[genre]["id"]) if not sGenre: guiElement = cGuiElement(genre.encode('utf-8'), SITE_IDENTIFIER, 'showGenres') oParams.setParam('genreID', genreID) oGui.addFolder(guiElement, oParams, iTotal=total) else: if genreID != sGenre: continue for serie in genres[genre]["series"]: sTitle = serie["name"].encode('utf-8') guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) oParams.addParams({ 'seriesID': str(serie["id"]), 'Title': sTitle }) oGui.addFolder(guiElement, oParams, iTotal=total) if sGenre: oGui.setView('tvshows') oGui.setEndOfDirectory()
def randomSerie(): oGui = cGui() oParams = ParameterHandler() serie = random.choice(_getJsonContent('series')) sTitle = serie["series"].encode('utf-8') guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) oParams.addParams({'seriesID': str(serie["id"]), 'Title': sTitle}) oGui.addFolder(guiElement, oParams, iTotal=1) oGui.setView('tvshows') oGui.setEndOfDirectory()
def randomSerie(): oGui = cGui() oParams = ParameterHandler() serie = random.choice(_getJsonContent('series')) sTitle = serie["series"].encode('utf-8') guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) oParams.addParams({'seriesID': str(serie["id"]), 'Title': sTitle}) oGui.addFolder(guiElement, oParams, iTotal=1) oGui.setEndOfDirectory()
def _search(oGui, sSearchText): params = ParameterHandler() series = _getJsonContent("series") total = len(series) sSearchText = sSearchText.lower() for serie in series: sTitle = serie["series"].encode('utf-8') if sTitle.lower().find(sSearchText) == -1: continue guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) params.addParams({'seriesID' : str(serie["id"]), 'Title' : sTitle}) oGui.addFolder(guiElement, params, iTotal = total)
def _search(oGui, sSearchText): params = ParameterHandler() series = _getJsonContent("series") total = len(series) sSearchText = sSearchText.lower() for serie in series: sTitle = serie["series"].encode('utf-8') if sTitle.lower().find(sSearchText) == -1: continue guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) params.addParams({'seriesID': str(serie["id"]), 'Title': sTitle}) oGui.addFolder(guiElement, params, iTotal=total)
def _search(oGui, sSearchText): params = ParameterHandler() oRequestHandler = cRequestHandler(URL_SEARCH + '?q=' + sSearchText) oRequestHandler.addHeaderEntry('X-Requested-With', 'XMLHttpRequest') sHtmlContent = oRequestHandler.request() series = json.loads(sHtmlContent) if series: total = len(series) for serie in series: sTitle = serie["name"].encode('utf-8') guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') params.addParams({'sUrl': serie['url'], 'Title': sTitle}) oGui.addFolder(guiElement, params, iTotal=total)
def showNews(): parms = ParameterHandler() sUrl = parms.getValue('sUrl') pattern = '<div class="Opt leftOpt Headlne"><h1>([a-zA-Z0-9\s.]+)' + \ '</h1></div>\s*<div class="Opt rightOpt Hint">Insgesamt: (.*?)</div>' sHtmlContent = __getHtmlContent(sUrl) aResult = cParser().parse(sHtmlContent, pattern) oGui = cGui() if aResult[0]: for aEntry in aResult[1]: sTitle = str(aEntry[0]) + ' (' + str(aEntry[1]) + ')' oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'parseNews') parms.addParams({'sUrl': URL_NEWS, 'page': 1, 'mediaType': 'news', 'sNewsTitle': aEntry[0]}) oGui.addFolder(oGuiElement, parms) oGui.setEndOfDirectory()
def _search(oGui, sSearchText): sUrl = URL_SERIES oRequestHandler = cRequestHandler(sUrl) params = ParameterHandler() sHtmlContent = oRequestHandler.request() series = json.loads(sHtmlContent) total = len(series) sSearchText = sSearchText.lower() for serie in series: sTitle = serie["series"].encode('utf-8') if sTitle.lower().find(sSearchText) != -1: guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) params.addParams({'siteUrl' : URL_SERIES + '/' + str(serie["id"]), 'Title' : sTitle}) oGui.addFolder(guiElement, params, iTotal = total)
def randomSerie(): oGui = cGui() oParams = ParameterHandler() series = _getJsonContent('series') if not series: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return serie = random.choice(series) sTitle = serie["series"].encode('utf-8') guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) oParams.addParams({'seriesID': str(serie["id"]), 'Title': sTitle}) oGui.addFolder(guiElement, oParams, iTotal=1) oGui.setView('tvshows') oGui.setEndOfDirectory()
def _search(sGui, sSearchText): oGui = sGui if sGui else cGui() params = ParameterHandler() series = _getJsonContent("series", ignoreErrors=(sGui is not False)) if not series: if not sGui: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return total = len(series) sSearchText = sSearchText.lower() for serie in series: sTitle = serie["series"].encode('utf-8') if sTitle.lower().find(sSearchText) == -1: continue guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') guiElement.setThumbnail(URL_COVER % serie["id"]) params.addParams({'seriesID': str(serie["id"]), 'Title': sTitle}) oGui.addFolder(guiElement, params, iTotal=total)
def showNews(): oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') sUrl = oParams.getValue('sUrl') sPattern = '<div class="Opt leftOpt Headlne"><h1>([a-zA-Z0-9\s.]+)' + \ '</h1></div>\s*<div class="Opt rightOpt Hint">Insgesamt: (.*?)</div>' sHtmlContent = __getHtmlContent(sUrl=sUrl, sSecurityValue=sSecurityValue) oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if aResult[0]: for aEntry in aResult[1]: sTitle = str(aEntry[0]) + ' (' + str(aEntry[1]) + ')' oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'parseNews') oParams.addParams({'sUrl': URL_NEWS, 'page': 1, 'mediaType': 'news', 'sNewsTitle': aEntry[0]}) oGui.addFolder(oGuiElement, oParams) oGui.setEndOfDirectory()
def showNews(): oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') sUrl = oParams.getValue('sUrl') sPattern = '<div class="Opt leftOpt Headlne"><h1>([a-zA-Z0-9\s.]+)'+\ '</h1></div>\s*<div class="Opt rightOpt Hint">Insgesamt: (.*?)</div>' sHtmlContent = __getHtmlContent(sUrl = sUrl, sSecurityValue = sSecurityValue) oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if (aResult[0] == True): for aEntry in aResult[1]: sTitle = str(aEntry[0]) + ' (' + str(aEntry[1]) + ')' oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER,'parseNews') oParams.addParams({'sUrl':URL_MAIN, 'page':1, 'mediaType':'news', 'sNewsTitle':aEntry[0]}) oGui.addFolder(oGuiElement, oParams) oGui.setEndOfDirectory()
def showGenresMenu(): logger.info('load displayGenreSite') oParams = ParameterHandler() sPattern = '<a href="' + URL_GENRE + '(.*?).html".*?>(.*?)</a>' # request sHtmlContent = __getHtmlContent(URL_MAIN) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if (aResult[0] == True): for aEntry in aResult[1]: guiElement = cGuiElement(aEntry[1], SITE_IDENTIFIER, 'showSeries') #guiElement.setMediaType('fGenre') #not necessary oParams.addParams({'sUrl': URL_GENRE + aEntry[0] + '/', 'iPage': 1}) oGui.addFolder(guiElement, oParams) oGui.setEndOfDirectory()
def showGenresMenu(): logger.info('load displayGenreSite') oParams = ParameterHandler() sPattern = '<li><a href="' + URL_GENRE + '(.*?).html".*?>(.*?)</a></li>' # request sHtmlContent = __getHtmlContent(URL_MAIN) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if (aResult[0] == True): for aEntry in aResult[1]: guiElement = cGuiElement(aEntry[1], SITE_IDENTIFIER, 'showSeries') #guiElement.setMediaType('fGenre') #not necessary oParams.addParams({'sUrl': URL_GENRE + aEntry[0] + '/', 'iPage': 1}) oGui.addFolder(guiElement, oParams) oGui.setEndOfDirectory()
def showGenresMenu(): logger.info('load showGenresMenu') oParams = ParameterHandler() sPattern = '<li class="cat-item.*?href="(.*?)"\s*?>(.*?)<' # request sHtmlContent = __getHtmlContent(URL_MAIN) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if aResult[0]: for link, title in aResult[1]: guiElement = cGuiElement(title, SITE_IDENTIFIER, 'showMovies') #guiElement.setMediaType('fGenre') # not necessary oParams.addParams({'sUrl': link, 'bShowAllPages': True}) oGui.addFolder(guiElement, oParams) oGui.setEndOfDirectory()
def showMovie(): logger.info('load showMovie') oParams = ParameterHandler() sPattern = 'class="list-group-item".*?<img.*?src="(.*?)".*?itemprop="image".*?<span itemprop="name">(.*?)</span>.*?class="episode-name".*?href="(.*?)".*?title="(.*?)"' # request sHtmlContent = __getHtmlContent() # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) oGui = cGui() if (aResult[0] == True): for img, eNr, link, title in aResult[1]: guiElement = cGuiElement('Film %s - %s' % (eNr, title), SITE_IDENTIFIER, 'showHosters') guiElement.setThumbnail(img) guiElement.setMediaType('movie') guiElement.setTVShowTitle(title) oParams.addParams({'sUrl': link, 'from_moviesever': True}) oGui.addFolder(guiElement, oParams, bIsFolder=False) oGui.setView('movies') oGui.setEndOfDirectory()
def parseMovieEntrySite(): oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') if (oParams.exist('sUrl')): sUrl = oParams.getValue('sUrl') # get movieEntrySite content sHtmlContent = __getHtmlContent(sUrl, sSecurityValue) sMovieTitle = __createMovieTitle(sHtmlContent) # get thumbnail result = cParser().parse(sHtmlContent, '<div class="Grahpics">.*?<img src="([^"]+)"') thumbnail = '' if result[0]: thumbnail = URL_MAIN + str(result[1][0]) bIsSerie = __isSerie(sHtmlContent) if (bIsSerie): oGui = cGui() aSeriesItems = parseSerieSite(sHtmlContent) if (len(aSeriesItems) > 0): imdbID = oParams.getValue('imdbID') for item in aSeriesItems: oGuiElement = cGuiElement(item['title'], SITE_IDENTIFIER, 'showHosters') sShowTitle = sMovieTitle.split('(')[0].split('*')[0] oGuiElement.setThumbnail(thumbnail) oGuiElement.setMediaType('episode') oGuiElement.setSeason(item['season']) oGuiElement.setEpisode(item['episode']) oGuiElement.setTVShowTitle(sShowTitle) oParams.addParams({'sUrl':item['url'], 'episode':item['episode'], 'season':item['season']}) oGui.addFolder(oGuiElement, oParams, bIsFolder = False, iTotal = len(aSeriesItems)) oGui.setView('episodes') oGui.setEndOfDirectory() else: logger.info('Movie') result = showHosters(sHtmlContent, sMovieTitle) return result
def _search(oGui, sSearchText): sUrl = URL_SERIES oRequestHandler = cRequestHandler(sUrl) oRequestHandler.addHeaderEntry('Referer', 'http://burning-seri.es/') params = ParameterHandler() sHtmlContent = oRequestHandler.request() sPattern = "<ul id='serSeries'>(.*?)</ul>" oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if not aResult[0]: return sHtmlContent = aResult[1][0] sPattern = '<li><a href="([^"]+)">(([^<]+)?%s([^<]+)?)</a></li>' % sSearchText oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern, ignoreCase = True) if not aResult[0]: return total = len(aResult[1]) for aEntry in aResult[1]: sTitle = cUtil().unescape(aEntry[1].decode('utf-8')).encode('utf-8') guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') params.addParams({'siteUrl' : URL_MAIN + '/' + str(aEntry[0]), 'Title' : sTitle}) oGui.addFolder(guiElement, params, iTotal = total)
def showSeries(): oGui = cGui() oParams = ParameterHandler() sUrl = URL_SERIES oRequestHandler = cRequestHandler(sUrl) oRequestHandler.addHeaderEntry('Referer', 'http://burning-seri.es/') sHtmlContent = oRequestHandler.request(); sChar = oParams.getValue('char') sPattern = "<ul id='serSeries'>(.*?)</ul>" oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: sHtmlContent = aResult[1][0] sPattern = '<li><a href="([^"]+)">(.*?)</a></li>' if sChar: if sChar == '#': sPattern = '<li><a href="([^"]+)">([^a-zA-Z].*?)</a></li>' else: sPattern = '<li><a href="([^"]+)">('+sChar+'.*?)</a></li>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: total = len(aResult[1]) for aEntry in aResult[1]: sTitle = cUtil().unescape(aEntry[1].decode('utf-8')).encode('utf-8') guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons') guiElement.setMediaType('tvshow') oParams.addParams({'siteUrl' : URL_MAIN + '/' + str(aEntry[0]), 'Title' : sTitle}) oGui.addFolder(guiElement, oParams, iTotal = total) oGui.setView('tvshows') oGui.setEndOfDirectory()