def showHosters(): oGui = cGui() oParams = ParameterHandler() sUrl = oParams.getValue('siteUrl') sTitle = oParams.getValue('sTitle') oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() sPattern = '<h3>Hoster dieser Episode(.*?)</ul>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: sHtmlContent = aResult[1][0] sPattern = '<li><a href="(.+?)"><span .+? class="icon (.+?)"></span>.+?</a>' aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: for sUrl, sHoster in aResult[1]: sUrl = '%s/%s' % (URL_MAIN, sUrl) oGuiElement = cGuiElement(sHoster, SITE_IDENTIFIER, 'getHosterUrlandPlay') oParams.setParam('siteUrl', sUrl) oParams.setParam('sTitle', sTitle) oGui.addFolder(oGuiElement, oParams, bIsFolder=True) oGui.setEndOfDirectory()
def showGenres(): oGui = cGui() oParams = ParameterHandler() oParams.setParam('siteUrl','/index.php/hd-oase/video/latest') oGuiElement = cGuiElement('Neuste', SITE_IDENTIFIER, 'showMovies') oGui.addFolder(oGuiElement, oParams) sUrl = URL_HD_GENRE oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() sPattern = '<div id="inner_content".*?<div class="clr">' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if not aResult[0]: return sPattern = '<div class="avs_thumb".*?href="([^"]+)".*?<span class="name">(.*?)</span>' aResult = oParser.parse(aResult[1][0], sPattern) if not aResult[0]: return sFunction = 'showMovies' iTotal = len(aResult[1]) for aEntry in aResult[1]: sLabel = aEntry[1] sUrl = aEntry[0] oParams.setParam('siteUrl',sUrl) oGuiElement = cGuiElement(sLabel, SITE_IDENTIFIER, sFunction) oGui.addFolder(oGuiElement, oParams, iTotal = iTotal+1) oGui.setEndOfDirectory()
def __parseMovieList(oGui, sHtml, oParams = False): if not oParams: oParams = ParameterHandler() sPattern = '<div class="avs_thumb".*?href="([^"]+)".*?class="image" src="([^"]+)".*?<span class="title">([^<]+)</span>' oParser = cParser() aResult = oParser.parse(sHtml, sPattern) if not aResult[0]: return sFunction = 'getHosters' iTotal = len(aResult[1]) for aEntry in aResult[1]: sLabel = aEntry[2].strip() sNextUrl = aEntry[0] sThumb = aEntry[1] oParams.setParam('siteUrl',sNextUrl) oParams.setParam('Title', sLabel) oGuiElement = cGuiElement(sLabel, SITE_IDENTIFIER, sFunction) oGuiElement.setThumbnail(sThumb) if META: oMetaget = metahandlers.MetaData() meta = oMetaget.get_meta('movie', sLabel) oGuiElement.setItemValues(meta) if not meta['cover_url'] == '': oGuiElement.setThumbnail(meta['cover_url']) if not meta['backdrop_url'] == '': oGuiElement.setFanart(meta['backdrop_url']) oGui.addFolder(oGuiElement, oParams, bIsFolder = False, iTotal = iTotal)
def showMovies(): oParams = ParameterHandler() if oParams.getValue('siteUrl'): sUrl = URL_MAIN + oParams.getValue('siteUrl') else: return oGui = cGui() oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() sPattern = '<div id="inner_content".*?<div class="clr">' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if not aResult[0]: return # parse movie entries __parseMovieList(oGui, str(aResult[1][0]), oParams = oParams) # check for next site aResult = oParser.parse(sHtmlContent, 'href="([^"]+)" title="Weiter"') if aResult[0]: oParams = ParameterHandler() oParams.setParam('siteUrl',aResult[1][0]) oGui.addNextPage(SITE_IDENTIFIER, 'showMovies', oParams) oGui.setView('movies') oGui.setEndOfDirectory()
def showHosters(): oGui = cGui() oParams= ParameterHandler() sTitle = oParams.getValue('Title') sUrl = oParams.getValue('siteUrl') oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() if not META: __createInfo(oGui, sHtmlContent, sTitle) sPattern = '<h3>Hoster dieser Episode(.*?)</ul>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): sHtmlContent = aResult[1][0] sPattern = '<li><a href="([^"]+)">.*?class="icon ([^"]+)"></span> ([^<]+?)</a>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: oHoster = cHosterHandler().getHoster2('//'+str(aEntry[1]).lower()+'/') if (oHoster != False): oGuiElement = cGuiElement(str(aEntry[2]),SITE_IDENTIFIER,'getHosterUrlandPlay') oParams.setParam('siteUrl',URL_MAIN + '/' + str(aEntry[0])) oParams.setParam('Hoster',oHoster) oGui.addFolder(oGuiElement, oParams, bIsFolder = True) oGui.setEndOfDirectory()
def showHosters(): oGui = cGui() oParams = ParameterHandler() sTitle = oParams.getValue('Title') sUrl = oParams.getValue('siteUrl') oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() if not META: __createInfo(oGui, sHtmlContent, sTitle) sPattern = '<h3>Hoster dieser Episode(.*?)</ul>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): sHtmlContent = aResult[1][0] sPattern = '<li><a href="([^"]+)">.*?class="icon ([^"]+)"></span> ([^<]+?)</a>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: oHoster = cHosterHandler().getHoster2('//' + str(aEntry[1]).lower() + '/') if (oHoster != False): oGuiElement = cGuiElement(str(aEntry[2]), SITE_IDENTIFIER, 'getHosterUrlandPlay') oParams.setParam('siteUrl', URL_MAIN + '/' + str(aEntry[0])) oParams.setParam('Hoster', oHoster) oGui.addFolder(oGuiElement, oParams, bIsFolder=True) oGui.setEndOfDirectory()
def showXXX(): params = ParameterHandler() oGui = cGui() __createMainMenuEntry(oGui, 'Alle Pornos', 661) #im Moment können keine Clips abgespielt werden da die Cliphoster nicht aufgelöst werden können #__createMainMenuEntry(oGui, 'Clips', 669, sSecurityValue) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('displaySearch') oGuiElement.setTitle('Suche XXX Streams') params.setParam('searchType', '530') oGui.addFolder(oGuiElement, params) __createMainMenuEntry(oGui, 'Amateure', '661&prefixid=Amateure1') __createMainMenuEntry(oGui, 'Anal', '661&prefixid=Anal') __createMainMenuEntry(oGui, 'Asia', '661&prefixid=Asia') __createMainMenuEntry(oGui, 'Black', '661&prefixid=Ebony') __createMainMenuEntry(oGui, 'B*****b', '661&prefixid=B*****b') __createMainMenuEntry(oGui, 'Deutsch', '661&prefixid=Deutsch') __createMainMenuEntry(oGui, 'Fetish', '661&prefixid=Fetish') __createMainMenuEntry(oGui, 'Große Brüste', '661&prefixid=GrosseBrueste') __createMainMenuEntry(oGui, 'Gruppensex', '661&prefixid=Gruppensex') __createMainMenuEntry(oGui, 'Gay', '661&prefixid=Gay') __createMainMenuEntry(oGui, 'Hardcore', '661&prefixid=Hardcore') __createMainMenuEntry(oGui, 'International', '661&prefixid=International') __createMainMenuEntry(oGui, 'Lesben', '661&prefixid=Lesben') __createMainMenuEntry(oGui, 'Masturbation', '661&prefixid=Masturbation') __createMainMenuEntry(oGui, 'Teens', '661&prefixid=Teens') oGui.setEndOfDirectory()
def __createMenuEntry(oGui, sFunction, sLabel, lParams, sMetaTitle='', iTotal=0): oParams = ParameterHandler() try: for param in lParams: oParams.setParam(param[0], param[1]) except Exception, e: logger.error("Can't add parameter to menu entry with label: %s: %s" % (sLabel, e)) oParams = ""
def __createMainMenuItem(oGui, sTitle, sPlaylistId): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('listVideos') oGuiElement.setTitle(sTitle) oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam('playlistId', sPlaylistId) oGui.addFolder(oGuiElement, oOutputParameterHandler)
def showSeriesMenu(): oGui = cGui() oParams = ParameterHandler() oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters'), oParams) #oGui.addFolder(cGuiElement('Genres',SITE_IDENTIFIER,'showGenres'),oParams) oParams.setParam('siteUrl', URL_FAVOURITE_SERIE_PAGE) oGui.addFolder(cGuiElement('Beliebteste Serien', SITE_IDENTIFIER, 'showFavItems'), oParams) oGui.setEndOfDirectory()
def showMovieMenu(): oGui = cGui() oParams = ParameterHandler() oGui.addFolder(cGuiElement('Kinofilme', SITE_IDENTIFIER, 'showCinemaMovies'), oParams) oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters'), oParams) oGui.addFolder(cGuiElement('Genres', SITE_IDENTIFIER, 'showGenres'), oParams) oParams.setParam('siteUrl', URL_FAVOURITE_MOVIE_PAGE) oGui.addFolder(cGuiElement('Beliebteste Filme', SITE_IDENTIFIER, 'showFavItems'), oParams) oGui.setEndOfDirectory()
def showDocuMenu(): oGui = cGui() oParams = ParameterHandler() oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters'), oParams) #oGui.addFolder(cGuiElement('Genres',SITE_IDENTIFIER,'showGenres'),oParams) oParams.setParam('siteUrl', URL_FAVOURITE_DOCU_PAGE) oGui.addFolder(cGuiElement('Beliebteste Dokumentationen', SITE_IDENTIFIER, 'showFavItems'), oParams) oParams.setParam('siteUrl', URL_LATEST_DOCU_PAGE) oGui.addFolder(cGuiElement('Neuste Dokumentationen', SITE_IDENTIFIER, 'showFavItems'), oParams) oGui.setEndOfDirectory()
def load(): oGui = cGui() oParams = ParameterHandler() oParams.setParam('siteUrl', URL_SERIES) oGui.addFolder(cGuiElement('All Shows', SITE_IDENTIFIER, 'showSeries'), oParams) oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters'), oParams) oGui.addFolder(cGuiElement('Last Episodes', SITE_IDENTIFIER, 'showLastEpisodes'), oParams) oGui.addFolder(cGuiElement('Search', SITE_IDENTIFIER, 'showSearch'), oParams) oGui.setEndOfDirectory()
def showSeriesMenu(): oGui = cGui() oParams = ParameterHandler() oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters'), oParams) #oGui.addFolder(cGuiElement('Genres',SITE_IDENTIFIER,'showGenres'),oParams) oParams.setParam('siteUrl', URL_FAVOURITE_SERIE_PAGE) oGui.addFolder( cGuiElement('Beliebteste Serien', SITE_IDENTIFIER, 'showFavItems'), oParams) oGui.setEndOfDirectory()
def __parseMovieResultSite(oGui, siteUrl, normalySiteUrl = '', iPage = 1): if not normalySiteUrl: normalySiteUrl = siteUrl+'&page=' params = ParameterHandler() sPattern = '<a class="p1" href="[^"]+".*?<img class="large" src="(http://[^"]+)"(.*?)<a href="([^"]+)" id="([^"]+)">([^<]+)<(.*?)</tr>' #sPattern = 'class="alt1Active".*?<a href="(forumdisplay.php[^"]+)".*?>([^<]+)<.*?(src="([^"]+)|</td>).*?</tr>' #Serien # request sHtmlContent = __getHtmlContent(sUrl = siteUrl) sHtmlContent # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == False): return total = len(aResult[1]) for aEntry in aResult[1]: sMovieTitle = aEntry[4].replace('&','&') sTitle = sMovieTitle sUrl = URL_SHOW_MOVIE + str(aEntry[3]).replace('thread_title_', '') year = '' aResult = oParser.parse(aEntry[5], ' ([0-9]{4}) -') if aResult[0]: year = aResult[1][0] aResult = oParser.parse(aEntry[1], '(title="HD Quali")') if aResult[0]: sTitle = sTitle + ' [HD]' oGuiElement = cGuiElement(sTitle,SITE_IDENTIFIER,'getHosters') oGuiElement.setMediaType('movie') oGuiElement.setYear(year) oGuiElement.setThumbnail(aEntry[0]) params.setParam('movieUrl', sUrl) params.setParam('sMovieTitle', sMovieTitle) oGui.addFolder(oGuiElement, params, bIsFolder = False, iTotal = total) # check for next site iTotalPages = __getTotalPages(iPage, sHtmlContent) if (iTotalPages >= int(iPage)+1): params = ParameterHandler() params.setParam('iPage', int(iPage)+1) params.setParam('normalySiteUrl', normalySiteUrl) params.setParam('siteUrl', normalySiteUrl+str(int(iPage)+1)) oGui.addNextPage(SITE_IDENTIFIER,'parseMovieResultSite', params, iTotalPages) if iTotalPages > 1: oGuiElement = cGuiElement('Go to page x of '+str(iTotalPages),SITE_IDENTIFIER,'gotoPage') params = ParameterHandler() oGui.addFolder(oGuiElement, params) oGui.setView('movies')
def showEpisodes(): oGui = cGui() oParams = ParameterHandler() sShowTitle = oParams.getValue('Title') sUrl = oParams.getValue('siteUrl') sImdb = oParams.getValue('imdbID') sSeason = oParams.getValue('Season') logger.info("%s: show episodes of '%s' season '%s' " % (SITE_NAME, sShowTitle, sSeason)) oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request(); sPattern = '<table>(.*?)</table>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): sHtmlContent = aResult[1][0] sPattern = '<td>([^<]+)</td>\s*<td><a href="([^"]+)">(.*?)</a>.*?<td class="nowrap">(\s*<a|\s*</td).*?</tr>' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: if aEntry[3].strip() == '</td': continue sNumber = str(aEntry[0]).strip() oGuiElement = cGuiElement('Episode ' + sNumber, SITE_IDENTIFIER, 'showHosters') if META == True and not sImdb == '': oMetaget = metahandlers.MetaData() meta = oMetaget.get_episode_meta(sShowTitle, sImdb, sSeason, sNumber) meta['TVShowTitle'] = sShowTitle oGuiElement.setItemValues(meta) oGuiElement.setThumbnail(meta['cover_url']) oGuiElement.setFanart(meta['backdrop_url']) sPattern = '<strong>(.*?)</strong>' aResultTitle = oParser.parse(str(aEntry[2]), sPattern) if (aResultTitle[0]== True): sTitleName = str(aResultTitle[1][0]).strip() else: sPattern = '<span lang="en">(.*?)</span>' aResultTitle = oParser.parse(str(aEntry[2]), sPattern) if (aResultTitle[0]== True): sTitleName = str(aResultTitle[1][0]).strip() else: sTitleName = '' sTitle = sNumber sTitleName = cUtil().unescape(sTitleName.decode('utf-8')).encode('utf-8') oParams.setParam('EpisodeTitle', sTitleName) sTitle = sTitle + ' - ' + sTitleName oGuiElement.setTitle(sTitle) oParams.setParam('siteUrl', URL_MAIN + '/' + str(aEntry[1])) oParams.setParam('EpisodeNr', sNumber) oParams.setParam('Title', sShowTitle+' - S'+sSeason+'E'+sTitle) oGui.addFolder(oGuiElement, oParams, iTotal = len(aResult[1])) oGui.setView('episodes') oGui.setEndOfDirectory()
def showMovieMenu(): oGui = cGui() oParams = ParameterHandler() oGui.addFolder( cGuiElement('Kinofilme', SITE_IDENTIFIER, 'showCinemaMovies'), oParams) oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters'), oParams) oGui.addFolder(cGuiElement('Genres', SITE_IDENTIFIER, 'showGenres'), oParams) oParams.setParam('siteUrl', URL_FAVOURITE_MOVIE_PAGE) oGui.addFolder( cGuiElement('Beliebteste Filme', SITE_IDENTIFIER, 'showFavItems'), oParams) oGui.setEndOfDirectory()
def showDocuMenu(): oGui = cGui() oParams = ParameterHandler() oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters'), oParams) #oGui.addFolder(cGuiElement('Genres',SITE_IDENTIFIER,'showGenres'),oParams) oParams.setParam('siteUrl', URL_FAVOURITE_DOCU_PAGE) oGui.addFolder( cGuiElement('Beliebteste Dokumentationen', SITE_IDENTIFIER, 'showFavItems'), oParams) oParams.setParam('siteUrl', URL_LATEST_DOCU_PAGE) oGui.addFolder( cGuiElement('Neuste Dokumentationen', SITE_IDENTIFIER, 'showFavItems'), oParams) oGui.setEndOfDirectory()
def load(): oGui = cGui() oParams = ParameterHandler() oParams.setParam('siteUrl', URL_SERIES) oGui.addFolder(cGuiElement('All Shows', SITE_IDENTIFIER, 'showSeries'), oParams) oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters'), oParams) oGui.addFolder( cGuiElement('Last Episodes', SITE_IDENTIFIER, 'showLastEpisodes'), oParams) oGui.addFolder(cGuiElement('Search', SITE_IDENTIFIER, 'showSearch'), oParams) oGui.setEndOfDirectory()
def __createMainMenuEntry(oGui, sMenuName, iCategoryId, sSecurityValue=''): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sMenuName) oGuiElement.setFunction('parseMovieResultSite') params = ParameterHandler() params.setParam('normalySiteUrl', URL_CATEGORIES + str(iCategoryId) + '&order=desc&page=') params.setParam('siteUrl', URL_CATEGORIES + str(iCategoryId) + '&order=desc&page=1') params.setParam('iPage', 1) params.setParam('securityCookie', sSecurityValue) oGui.addFolder(oGuiElement, params)
def load(): oGui = cGui() sSecurityValue = __getSecurityCookieValue() __createMainMenuEntry(oGui, 'Aktuelle KinoFilme', 542, sSecurityValue) oGui.addFolder(cGuiElement('HD Filme',SITE_IDENTIFIER,'showHDMovies')) __createMainMenuEntry(oGui, 'Action', 591, sSecurityValue) __createMainMenuEntry(oGui, 'Horror', 593, sSecurityValue) __createMainMenuEntry(oGui, 'Komoedie', 592, sSecurityValue) __createMainMenuEntry(oGui, 'Thriller', 595, sSecurityValue) __createMainMenuEntry(oGui, 'Drama', 594, sSecurityValue) __createMainMenuEntry(oGui, 'Fantasy', 655, sSecurityValue) __createMainMenuEntry(oGui, 'Abenteuer', 596, sSecurityValue) __createMainMenuEntry(oGui, 'Animation', 677, sSecurityValue) __createMainMenuEntry(oGui, 'Dokumentation', 751, sSecurityValue) #__createMainMenuEntry(oGui, 'Serien', 543, sSecurityValue) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('displaySearch') oGuiElement.setTitle('Suche Filme') params = ParameterHandler() params.setParam('securityCookie', sSecurityValue) params.setParam('searchType', '528') oGui.addFolder(oGuiElement, params) # Serien parsing nicht implementiert #oGuiElement = cGuiElement() #oGuiElement.setSiteName(SITE_IDENTIFIER) #oGuiElement.setFunction('displaySearch') #oGuiElement.setTitle('Suche Serien') #params.setParam('searchType', '532') #oGui.addFolder(oGuiElement, params) if showAdult(): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showXXX') oGuiElement.setTitle('XXX') oGui.addFolder(oGuiElement, params) oGui.setEndOfDirectory()
def showSeriesForGenre(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() gTitle = oInputParameterHandler.getValue('sTitle') oRequestHandler = cRequestHandler(URL_GENRE) oRequestHandler.addHeaderEntry('Referer', URL_MAIN) sHtmlContent = oRequestHandler.request() sPattern = '<div class="genre">.+?<span><strong>%s</strong></span>.+?<ul>(.+?)</div>' % ( gTitle) oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: sPattern = '<li><a href="(.+?)">(.+?)</a></li>' aResult = oParser.parse(aResult[1][0], sPattern) if aResult[0]: for sUrl, sTitle in aResult[1]: sUrl = '%s/%s' % (URL_MAIN, sUrl) oParams = ParameterHandler() oParams.setParam('sTitle', sTitle) oParams.setParam('siteUrl', sUrl) oParams.setParam('imdbID', '') oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showSeasons') oGuiElement.setTitle(sTitle) oGui.addFolder(oGuiElement, oParams) oGui.setEndOfDirectory()
def showSeriesForGenre(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() gTitle = oInputParameterHandler.getValue('sTitle') oRequestHandler = cRequestHandler(URL_GENRE) oRequestHandler.addHeaderEntry('Referer', URL_MAIN) sHtmlContent = oRequestHandler.request() sPattern = '<div class="genre">.+?<span><strong>%s</strong></span>.+?<ul>(.+?)</div>' % (gTitle) oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: sPattern = '<li><a href="(.+?)">(.+?)</a></li>' aResult = oParser.parse(aResult[1][0], sPattern) if aResult[0]: for sUrl, sTitle in aResult[1]: sUrl = '%s/%s' % (URL_MAIN, sUrl) oParams = ParameterHandler() oParams.setParam('sTitle', sTitle) oParams.setParam('siteUrl', sUrl) oParams.setParam('imdbID', '') oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showSeasons') oGuiElement.setTitle(sTitle) oGui.addFolder(oGuiElement, oParams) oGui.setEndOfDirectory()
def __showPlayMenu(self, oGui, sMediaUrl, oHoster, bGetRedirectUrl, sFileName=''): print "cHosterGui.showPlayMenu is deprecated" oGuiElement = cGuiElement('play',self.SITE_NAME,'play') oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam('sMediaUrl', sMediaUrl) oOutputParameterHandler.setParam('bGetRedirectUrl', bGetRedirectUrl) oOutputParameterHandler.setParam('sFileName', sFileName) oGui.addFolder(oGuiElement, oOutputParameterHandler)
def showGenres(): oGui = cGui() oRequestHandler = cRequestHandler(URL_GENRE) oRequestHandler.addHeaderEntry('Referer', URL_MAIN) sHtmlContent = oRequestHandler.request() sPattern = '<div class="genre">.+?<span><strong>(.+?)</strong></span>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: for genreTitle in aResult[1]: oParams = ParameterHandler() oParams.setParam('sTitle', genreTitle) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showSeriesForGenre') oGuiElement.setTitle(genreTitle) oGui.addFolder(oGuiElement, oParams) oGui.setEndOfDirectory()
def __parseMovieList(oGui, sHtml, oParams = False): if not oParams: oParams = ParameterHandler() sPattern = '<div class="avs_thumb".*?href="([^"]+)".*?class="image" src="([^"]+)".*?<span class="title">([^<]+)</span>' oParser = cParser() aResult = oParser.parse(sHtml, sPattern) if not aResult[0]: return sFunction = 'getHosters' iTotal = len(aResult[1]) for aEntry in aResult[1]: sLabel = aEntry[2].split('(') sTitle = sLabel[0].strip() sNextUrl = aEntry[0] sThumb = aEntry[1] oParams.setParam('siteUrl',sNextUrl) oParams.setParam('Title', sTitle) oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER, sFunction) oGuiElement.setThumbnail(sThumb) oGuiElement.setMediaType('movie') if len(sLabel)>1: year = sLabel[-1].replace(')','') oGuiElement.setYear(year) oGui.addFolder(oGuiElement, oParams, bIsFolder = False, iTotal = iTotal)
def showEpisodes(): oGui = cGui() oParams = ParameterHandler() sShowTitle = oParams.getValue('Title') sUrl = oParams.getValue('siteUrl') sImdb = oParams.getValue('imdbID') sSeason = oParams.getValue('Season') logger.info("%s: show episodes of '%s', season '%s' " % (SITE_NAME, sShowTitle, sSeason)) oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() oParser = cParser() hParser = HTMLParser.HTMLParser() sPattern = '<tr>\s*<td>(.+?)</td>\s*<td><a href="(.+?)">\s*<strong>(.+?)</strong>.*?</tr>' aResult = oParser.parse(sHtmlContent, sPattern) try: if aResult[0]: for sNumber, sUrl, episodeTitle in aResult[1]: sUrl = '%s/%s' % (URL_MAIN, sUrl) episodeTitle = hParser.unescape(episodeTitle) oGuiElement = cGuiElement('Episode ' + sNumber, SITE_IDENTIFIER, 'showHosters') if META and sImdb: oMetaget = metahandlers.MetaData() meta = oMetaget.get_episode_meta(sShowTitle, sImdb, sSeason, sNumber) meta['TVShowTitle'] = sShowTitle oGuiElement.setItemValues(meta) oGuiElement.setThumbnail(meta['cover_url']) oGuiElement.setFanart(meta['backdrop_url']) # how do we detect the language of the episode ? # fixed to 'de' for now as most of it seems to be german on burning-seri.es sTitle = 's%se%s - %s (%s)' % ( sSeason.zfill(2), sNumber.zfill(2), episodeTitle, 'de') oGuiElement.setTitle(sTitle) oParams.setParam('siteUrl', sUrl) oParams.setParam('EpisodeNr', sNumber) oParams.setParam('sTitle', sTitle) oGui.addFolder(oGuiElement, oParams, iTotal=len(aResult[1])) oGui.setView('episodes') except: import traceback traceback.print_exc() oGui.setEndOfDirectory()
def showSeasons(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sTitle = oInputParameterHandler.getValue('Title') sUrl = oInputParameterHandler.getValue('siteUrl') sImdb = oInputParameterHandler.getValue('imdbID') logger.info("%s: show seasons of '%s' " % (SITE_NAME, sTitle)) oRequestHandler = cRequestHandler(sUrl) oRequestHandler.addHeaderEntry('Referer', URL_MAIN) sHtmlContent = oRequestHandler.request() sPattern = '<ul class="pages">(.*?)</ul>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: sHtmlContent = aResult[1][0] sPattern = '[^n]"><a href="([^"]+)">(.*?)</a>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: seasonNums = [] for aEntry in aResult[1]: seasonNums.append(str(aEntry[1])) if META and not sImdb == '': oMetaget = metahandlers.MetaData() meta = oMetaget.get_seasons(sTitle, sImdb, seasonNums) ii = 0 for aEntry in aResult[1]: seasonNum = seasonNums[ii] oGuiElement = cGuiElement('Staffel ' + seasonNum, SITE_IDENTIFIER, 'showEpisodes') if META and not sImdb == '': meta[ii]['TVShowTitle'] = sTitle oGuiElement.setItemValues(meta[ii]) oGuiElement.setThumbnail(meta[ii]['cover_url']) oGuiElement.setFanart(meta[ii]['backdrop_url']) oParams = ParameterHandler() oParams.setParam('siteUrl', URL_MAIN + '/' + str(aEntry[0])) oParams.setParam('Title', sTitle) oParams.setParam('Season', seasonNum) oGui.addFolder(oGuiElement, oParams, iTotal=len(aResult[1])) ii += 1 oGui.setView('seasons') oGui.setEndOfDirectory()
def showEpisodes(): oGui = cGui() oParams = ParameterHandler() sShowTitle = oParams.getValue('Title') sUrl = oParams.getValue('siteUrl') sImdb = oParams.getValue('imdbID') sSeason = oParams.getValue('Season') logger.info("%s: show episodes of '%s', season '%s' " % (SITE_NAME, sShowTitle, sSeason)) oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() oParser = cParser() hParser = HTMLParser.HTMLParser() sPattern = '<tr>\s*<td>(.+?)</td>\s*<td><a href="(.+?)">\s*<strong>(.+?)</strong>.*?</tr>' aResult = oParser.parse(sHtmlContent, sPattern) try: if aResult[0]: for sNumber, sUrl, episodeTitle in aResult[1]: sUrl = '%s/%s' % (URL_MAIN, sUrl) episodeTitle = hParser.unescape(episodeTitle) oGuiElement = cGuiElement('Episode ' + sNumber, SITE_IDENTIFIER, 'showHosters') if META and sImdb: oMetaget = metahandlers.MetaData() meta = oMetaget.get_episode_meta(sShowTitle, sImdb, sSeason, sNumber) meta['TVShowTitle'] = sShowTitle oGuiElement.setItemValues(meta) oGuiElement.setThumbnail(meta['cover_url']) oGuiElement.setFanart(meta['backdrop_url']) # how do we detect the language of the episode ? # fixed to 'de' for now as most of it seems to be german on burning-seri.es sTitle = 's%se%s - %s (%s)' % (sSeason.zfill(2), sNumber.zfill(2), episodeTitle, 'de') oGuiElement.setTitle(sTitle) oParams.setParam('siteUrl', sUrl) oParams.setParam('EpisodeNr', sNumber) oParams.setParam('sTitle', sTitle) oGui.addFolder(oGuiElement, oParams, iTotal=len(aResult[1])) oGui.setView('episodes') except: import traceback traceback.print_exc() oGui.setEndOfDirectory()
def showEpisodes(): oGui = cGui() oParams = ParameterHandler() sShowTitle = oParams.getValue('Title') sUrl = oParams.getValue('siteUrl') sImdb = oParams.getValue('imdbID') sSeason = oParams.getValue('Season') logger.info("%s: show episodes of '%s' season '%s' " % (SITE_NAME, sShowTitle, sSeason)) oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() sPattern = '<table>(.*?)</table>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): sHtmlContent = aResult[1][0] sPattern = '<td>([^<]+)</td>\s*<td><a href="([^"]+)">(.*?)</a>.*?<td class="nowrap">(\s*<a|\s*</td).*?</tr>' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: if aEntry[3].strip() == '</td': continue sNumber = str(aEntry[0]).strip() oGuiElement = cGuiElement('Episode ' + sNumber, SITE_IDENTIFIER, 'showHosters') if META == True and not sImdb == '': oMetaget = metahandlers.MetaData() meta = oMetaget.get_episode_meta(sShowTitle, sImdb, sSeason, sNumber) meta['TVShowTitle'] = sShowTitle oGuiElement.setItemValues(meta) oGuiElement.setThumbnail(meta['cover_url']) oGuiElement.setFanart(meta['backdrop_url']) sPattern = '<strong>(.*?)</strong>' aResultTitle = oParser.parse(str(aEntry[2]), sPattern) if (aResultTitle[0] == True): sTitleName = str(aResultTitle[1][0]).strip() else: sPattern = '<span lang="en">(.*?)</span>' aResultTitle = oParser.parse(str(aEntry[2]), sPattern) if (aResultTitle[0] == True): sTitleName = str(aResultTitle[1][0]).strip() else: sTitleName = '' sTitle = sNumber sTitleName = cUtil().unescape( sTitleName.decode('utf-8')).encode('utf-8') oParams.setParam('EpisodeTitle', sTitleName) sTitle = sTitle + ' - ' + sTitleName oGuiElement.setTitle(sTitle) oParams.setParam('siteUrl', URL_MAIN + '/' + str(aEntry[1])) oParams.setParam('EpisodeNr', sNumber) oParams.setParam('Title', sShowTitle + ' - S' + sSeason + 'E' + sTitle) oGui.addFolder(oGuiElement, oParams, iTotal=len(aResult[1])) oGui.setView('episodes') oGui.setEndOfDirectory()
def load(): logger.info("Load %s" % SITE_NAME) sSecurityValue = __getSecurityCookieValue() __initSiteLanguage(sSecurityValue) oParams = ParameterHandler() oParams.setParam('securityCookie', sSecurityValue) ## Create all main menu entries oGui = cGui() oParams.setParam('siteUrl', URL_MAIN) oParams.setParam('page', 1) oParams.setParam('mediaType', 'news') oGui.addFolder(cGuiElement('Neues von Heute', SITE_IDENTIFIER, 'showNews'), oParams) oParams.setParam('siteUrl', URL_MOVIE_PAGE) oParams.setParam('mediaType', 'movie') oGui.addFolder(cGuiElement('Filme', SITE_IDENTIFIER, 'showMovieMenu'), oParams) oParams.setParam('siteUrl', URL_DOCU_PAGE) oParams.setParam('mediaType', 'series') oGui.addFolder(cGuiElement('Serien', SITE_IDENTIFIER, 'showSeriesMenu'), oParams) oParams.setParam('siteUrl', URL_SERIE_PAGE) oParams.setParam('mediaType', 'documentation') oGui.addFolder( cGuiElement('Dokumentationen', SITE_IDENTIFIER, 'showDocuMenu'), oParams) oParams.setParam('siteUrl', URL_SEARCH) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch'), oParams) # __createMenuEntry(oGui, 'showNews', 'Neues von Heute', [['siteUrl', URL_MAIN], ['page', 1], # ['mediaType', 'news'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showCinemaMovies', 'Aktuelle KinoFilme', # [['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showCharacters', 'Filme', [['siteUrl', URL_MOVIE_PAGE], # ['page', 1], ['mediaType', 'movie'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showGenres', 'Genre', [['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showCharacters', 'Serien', [['siteUrl', URL_SERIE_PAGE], # ['page', 1], ['mediaType', 'series'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showCharacters', 'Dokumentationen', [['siteUrl', URL_DOCU_PAGE], # ['page', 1], ['mediaType', 'documentation'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Beliebteste Filme', # [['siteUrl', URL_FAVOURITE_MOVIE_PAGE], ['page', 1], ['mediaType', 'movie'], # ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Beliebteste Serien', # [['siteUrl', URL_FAVOURITE_SERIE_PAGE], ['page', 1], ['mediaType', 'series'], # ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Beliebteste Dokumentationen', # [['siteUrl', URL_FAVOURITE_DOCU_PAGE], ['page', 1], ['mediaType', 'documentation'], # ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Neuste Serien', [['siteUrl', URL_LATEST_SERIE_PAGE], # ['page', 1], ['mediaType', 'series'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Neuste Dokumentationen', # [['siteUrl', URL_LATEST_DOCU_PAGE], ['page', 1], ['mediaType', 'documentation'], # ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showSearch', 'Suche', [['siteUrl', URL_SEARCH], # ['securityCookie', sSecurityValue]]) oGui.setEndOfDirectory()
def load(): logger.info("Load %s" % SITE_NAME) sSecurityValue = __getSecurityCookieValue() __initSiteLanguage(sSecurityValue) oParams = ParameterHandler() oParams.setParam('securityCookie', sSecurityValue) ## Create all main menu entries oGui = cGui() oParams.setParam('siteUrl', URL_MAIN) oParams.setParam('page', 1) oParams.setParam('mediaType', 'news') oGui.addFolder(cGuiElement('Neues von Heute', SITE_IDENTIFIER, 'showNews'), oParams) oParams.setParam('siteUrl', URL_MOVIE_PAGE) oParams.setParam('mediaType', 'movie') oGui.addFolder(cGuiElement('Filme', SITE_IDENTIFIER, 'showMovieMenu'), oParams) oParams.setParam('siteUrl', URL_DOCU_PAGE) oParams.setParam('mediaType', 'series') oGui.addFolder(cGuiElement('Serien', SITE_IDENTIFIER, 'showSeriesMenu'), oParams) oParams.setParam('siteUrl', URL_SERIE_PAGE) oParams.setParam('mediaType', 'documentation') oGui.addFolder(cGuiElement('Dokumentationen', SITE_IDENTIFIER, 'showDocuMenu'), oParams) oParams.setParam('siteUrl', URL_SEARCH) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch'), oParams) # __createMenuEntry(oGui, 'showNews', 'Neues von Heute', [['siteUrl', URL_MAIN], ['page', 1], # ['mediaType', 'news'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showCinemaMovies', 'Aktuelle KinoFilme', # [['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showCharacters', 'Filme', [['siteUrl', URL_MOVIE_PAGE], # ['page', 1], ['mediaType', 'movie'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showGenres', 'Genre', [['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showCharacters', 'Serien', [['siteUrl', URL_SERIE_PAGE], # ['page', 1], ['mediaType', 'series'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showCharacters', 'Dokumentationen', [['siteUrl', URL_DOCU_PAGE], # ['page', 1], ['mediaType', 'documentation'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Beliebteste Filme', # [['siteUrl', URL_FAVOURITE_MOVIE_PAGE], ['page', 1], ['mediaType', 'movie'], # ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Beliebteste Serien', # [['siteUrl', URL_FAVOURITE_SERIE_PAGE], ['page', 1], ['mediaType', 'series'], # ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Beliebteste Dokumentationen', # [['siteUrl', URL_FAVOURITE_DOCU_PAGE], ['page', 1], ['mediaType', 'documentation'], # ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Neuste Serien', [['siteUrl', URL_LATEST_SERIE_PAGE], # ['page', 1], ['mediaType', 'series'], ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showFavItems', 'Neuste Dokumentationen', # [['siteUrl', URL_LATEST_DOCU_PAGE], ['page', 1], ['mediaType', 'documentation'], # ['securityCookie', sSecurityValue]]) # __createMenuEntry(oGui, 'showSearch', 'Suche', [['siteUrl', URL_SEARCH], # ['securityCookie', sSecurityValue]]) oGui.setEndOfDirectory()
def listVideos(): oGui = cGui() oInputParameterHandler = ParameterHandler() if (oInputParameterHandler.exist('playlistId')): sPlaylistId = oInputParameterHandler.getValue('playlistId') if not oInputParameterHandler.exist('sUrl'): sUrl = URL_TV + str(sPlaylistId) else: sUrl = oInputParameterHandler.getValue('sUrl') if sPlaylistId == 'spieltag': oParser = cParser() if sUrl.find(URL_TV) != -1: sUrl = 'http://www.bundesliga.de/de/bundesliga-tv/index.php' oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() sPattern = '\'(/de/bundesliga-tv/navigation.php\?area=spieltag&saison=(\d+)[^\']+)\'' aResult = oParser.parse(sHtmlContent, sPattern) sUrl = URL_MAIN + aResult[1][0][0] sSaison = aResult[1][0][1] else: sSaison = oParser.parse(sUrl, '&saison=(\d+)')[1][0] oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() sPattern = '<div class="matchDay matchDay[^<]*onclick="retrieveURL\(\'([^\']+)\'.*?>([^<]+)</div>' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): #ausgewählte Saison for aEntry in aResult[1]: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('listVideos') oGuiElement.setTitle(aEntry[1]) sUrl = URL_MAIN + str(aEntry[0]) oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam('sUrl', sUrl) oOutputParameterHandler.setParam('playlistId', 'spieltagEinzeln') oGui.addFolder(oGuiElement, oOutputParameterHandler) #ältere Saison oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('listVideos') lastSaison = str(int(sSaison) - 1) oGuiElement.setTitle('* Saison %s/%s *' % (lastSaison,sSaison)) sUrl = sUrl.replace(sSaison, lastSaison) oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam('sUrl', sUrl) oOutputParameterHandler.setParam('playlistId', 'spieltag') oGui.addFolder(oGuiElement, oOutputParameterHandler) elif sPlaylistId == 'vereine': sPattern = '<div class="teamWappen" onclick="retrieveURL\(\'([^\']+)\'.*?<img src="([^"]+)" title="Videos des ([^"]+)" /></div>' oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('listVideos') oGuiElement.setTitle((aEntry[2])) sThumbnail = URL_MAIN + str(aEntry[1]) oGuiElement.setThumbnail(sThumbnail) sUrl = URL_MAIN + str(aEntry[0]) oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam('sUrl', sUrl) oOutputParameterHandler.setParam('playlistId', 'verein') oGui.addFolder(oGuiElement, oOutputParameterHandler) else: sPattern = '<div class="zeile">.*?<img src="([^"]+)" id="bild" class="previewImg".*?<a href="javascript:showVideoSnippet\(\'([^\']+)\'\).*?title="([^"]+)".*?<div class="describe">(.*?)</div>' oRequest = cRequestHandler(sUrl) sHtmlContent = oRequest.request() oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: sThumbnail = URL_MAIN + str(aEntry[0]) sUrl = URL_MAIN + str(aEntry[1]) sTitle = cUtil().unescape(str(aEntry[2]).decode('utf-8')).encode('utf-8') sDescription = cUtil().unescape(str(aEntry[3]).decode('utf-8')).encode('utf-8') oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('play') oGuiElement.setTitle(sTitle) oGuiElement.setDescription(sDescription) oGuiElement.setThumbnail(sThumbnail) oOutputParameterHandler = ParameterHandler() oOutputParameterHandler.setParam('sUrl', sUrl) oOutputParameterHandler.setParam('sTitle', sTitle) oGui.addFolder(oGuiElement, oOutputParameterHandler, bIsFolder = False) oGui.setView('movies') oGui.setEndOfDirectory()