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 load(): logger.info("Load %s" % SITE_NAME) sSecurityValue = __getSecurityCookieValue() oParams = ParameterHandler() if sSecurityValue: oParams.setParam('securityCookie', sSecurityValue) # Create all main menu entries oGui = cGui() oParams.setParam('sUrl', URL_NEWS) oParams.setParam('page', 1) oParams.setParam('mediaType', 'news') oGui.addFolder(cGuiElement('Neues von Heute', SITE_IDENTIFIER, 'showNews'), oParams) oParams.setParam('sUrl', URL_MOVIE_PAGE) oParams.setParam('mediaType', 'movie') oGui.addFolder(cGuiElement('Filme', SITE_IDENTIFIER, 'showMovieMenu'), oParams) oParams.setParam('sUrl', URL_SERIE_PAGE) oParams.setParam('mediaType', 'series') oGui.addFolder(cGuiElement('Serien', SITE_IDENTIFIER, 'showSeriesMenu'), oParams) oParams.setParam('sUrl', URL_DOCU_PAGE) oParams.setParam('mediaType', 'documentation') oGui.addFolder(cGuiElement('Dokumentationen', SITE_IDENTIFIER, 'showDocuMenu'), oParams) oParams.setParam('sUrl', URL_SEARCH) oParams.setParam('mediaType', '') oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch'), oParams) oGui.setEndOfDirectory()
def settingsGuiElements(): # Create a gui element for addon settings oGuiElement = cGuiElement() oGuiElement.setTitle("xStream Settings") oGuiElement.setSiteName("xStream") oGuiElement.setFunction("display_settings") oGuiElement.setThumbnail("DefaultAddonProgram.png") xStreamSettings = oGuiElement # Create a gui element for urlresolver settings oGuiElement = cGuiElement() oGuiElement.setTitle("Resolver Settings") oGuiElement.setSiteName("urlresolver") oGuiElement.setFunction("display_settings") oGuiElement.setThumbnail("DefaultAddonRepository.png") urlResolverSettings = oGuiElement # Create a gui element for metahandler settings oGuiElement = cGuiElement() oGuiElement.setTitle("Metahandler Settings") oGuiElement.setSiteName("metahandler") oGuiElement.setFunction("display_settings") oGuiElement.setThumbnail("DefaultAddonTvInfo.png") metaSettings = oGuiElement if cConfig().getSetting('metahandler') == 'true': return xStreamSettings, urlResolverSettings, metaSettings return xStreamSettings, urlResolverSettings
def load(): cGui().showInfo('HS', SITE_NAME, 5) return False oConfig = cConfig() oGui = cGui() oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('displaySeasions') oGuiElement.setTitle(oConfig.getLocalizedString(30302)) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('language', '') oGui.addFolder(oGuiElement, oOutputParameterHandler) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('displaySeasions') oGuiElement.setTitle(oConfig.getLocalizedString(30303)) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('language', 'en') oGui.addFolder(oGuiElement, oOutputParameterHandler) 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 load(): logger.info("Load %s" % SITE_NAME) oGui = cGui() oGui.addFolder(cGuiElement('Filme', SITE_IDENTIFIER, 'showMovieMenu')) oGui.addFolder(cGuiElement('Serien', SITE_IDENTIFIER, 'showTvShowMenu')) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch')) oGui.setEndOfDirectory()
def load(): oGui = cGui() oParams = ParameterHandler() oGui.addFolder(cGuiElement('Series', SITE_IDENTIFIER, 'showSeries'), oParams) oGui.addFolder(cGuiElement('Genres', SITE_IDENTIFIER, 'showGenres'), oParams) oGui.setEndOfDirectory()
def load(): logger.info("Load %s" % SITE_NAME) oGui = cGui() oGui.addFolder(cGuiElement('Alle Serien', SITE_IDENTIFIER, 'showSeries')) oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters')) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch')) 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 __parseSite(sHtmlContent, sSiteUrl, iCurrentPage): oGui = cGui() sPattern = '<span class="img">\s*<img src="([^"]+)".*?<h4>\s*<a href="([^"]+)">\s*(.*?)\s*</a>\s*</h4>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setThumbnail(str(aEntry[0])) oGuiElement.setFunction('showHoster') sTitle = aEntry[2] oGuiElement.setTitle(sTitle) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sSiteUrl', URL_MAIN + '/channel-popup' + str(aEntry[1]).replace('/channel','')) oGui.addFolder(oGuiElement, oOutputParameterHandler) iNextPage = __checkForNextPage(sHtmlContent, iCurrentPage) if (iNextPage != False): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showLiveVideos') oGuiElement.setTitle('next..') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sSiteUrl', sSiteUrl) oOutputParameterHandler.addParameter('iPage', str(iNextPage)) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setEndOfDirectory()
def __parseMovieSimpleList(sHtmlContent, iPage): oGui = cGui() sPattern = '<TR>.*?<a href="([^"]+)">(.*?)</a>.*?<img border=0 src="http://www.movie2k.com/img/(.*?).png' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showHoster') sTitle = aEntry[1].strip().replace('\t', '') + __getLanmguage(aEntry[2]) oGuiElement.setTitle(sTitle) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sUrl', aEntry[0]) oGui.addFolder(oGuiElement, oOutputParameterHandler) sNextUrl = __checkForNextPage(sHtmlContent, iPage) if (sNextUrl != False): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('parseMovieSimpleList') oGuiElement.setTitle('next ..') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sUrl', sNextUrl) oOutputParameterHandler.addParameter('iPage', int(iPage) + 1) oGui.addFolder(oGuiElement, oOutputParameterHandler) 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 __parseSite(sHtmlContent, sSiteUrl, iCurrentPage): oGui = cGui() sPattern = '<a href="/channel/(.*?)">.*?<span class="img"><img.*?rel="([^"]+)".*?<span>(.*?)</span>.*?<span class="liveViewers">(.*?)</span>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setThumbnail(str(aEntry[1])) oGuiElement.setFunction('showHoster') sTitle = __createTitle(aEntry[2], aEntry[3]) oGuiElement.setTitle(sTitle) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sSiteUrl', URL_MAIN + '/channel/' + str(aEntry[0])) oGui.addFolder(oGuiElement, oOutputParameterHandler) iNextPage = __checkForNextPage(sHtmlContent, iCurrentPage) if (iNextPage != False): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showLiveVideos') oGuiElement.setTitle('next..') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sSiteUrl', sSiteUrl) oOutputParameterHandler.addParameter('iPage', str(iNextPage)) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setEndOfDirectory()
def load(): oParams = ParameterHandler() oGui = cGui() oGui.addFolder(cGuiElement("Neue Filme", SITE_IDENTIFIER, "showNewMovies"), oParams) oGui.addFolder(cGuiElement("Kategorien", SITE_IDENTIFIER, "showGenresMenu"), oParams) oGui.addFolder(cGuiElement("Suche", SITE_IDENTIFIER, "showSearch"), oParams) oGui.setEndOfDirectory()
def load(): oParams = ParameterHandler() oGui = cGui() oGui.addFolder(cGuiElement('Neue Filme', SITE_IDENTIFIER, 'showNewMovies'), oParams) oGui.addFolder(cGuiElement('Kategorien', SITE_IDENTIFIER, 'showGenresMenu'), oParams) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch'), oParams) oGui.setEndOfDirectory()
def showBasicMenu(): oGui = cGui() params = ParameterHandler() oGui.addFolder(cGuiElement('Filme', SITE_IDENTIFIER, 'showMovieMenu'), params) oGui.addFolder(cGuiElement('Serien', SITE_IDENTIFIER, 'showSeriesMenu'), params) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch'), params) oGui.setEndOfDirectory()
def showTop100Menu(): oGui = cGui() params = ParameterHandler() params.setParam('sUrl',URL_TOP100 + 'today/' + params.getValue('sTop100Type')) oGui.addFolder(cGuiElement('Heute', SITE_IDENTIFIER, 'showEntries'), params) params.setParam('sUrl',URL_TOP100 + 'month/' + params.getValue('sTop100Type')) oGui.addFolder(cGuiElement('Monat', SITE_IDENTIFIER, 'showEntries'), params) 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 showTvShowMenu(): oGui = cGui() params = ParameterHandler() params.setParam('mediaTypePageId', 1) params.setParam('sUrl', URL_SHOWS) oGui.addFolder(cGuiElement('Alle Serien', SITE_IDENTIFIER, 'showEntries'), params) oGui.addFolder(cGuiElement('Genre', SITE_IDENTIFIER, 'showGenre'), params) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showTvShowSearch')) oGui.setEndOfDirectory()
def __parseMovieResultSite(siteUrl, normalySiteUrl, iPage): oInputParameterHandler = cInputParameterHandler() if oInputParameterHandler.exist('securityCookie'): sSecurityValue = oInputParameterHandler.getValue('securityCookie') oGui = cGui() sPattern = '<a class="p1" href="[^"]+" >.*?<img class="large" src="(http://[^"]+)".*?<a href="([^"]+)" id="([^"]+)">([^<]+)<' # request sHtmlContent = __getHtmlContent(sUrl = siteUrl) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: sMovieTitle = aEntry[3].replace('&','&') sUrl = URL_SHOW_MOVIE + str(aEntry[2]).replace('thread_title_', '') oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('parseMovie') oGuiElement.setTitle(sMovieTitle) oGuiElement.setThumbnail(aEntry[0]) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('movieUrl', sUrl) oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('securityCookie', sSecurityValue) oGui.addFolder(oGuiElement, oOutputParameterHandler) # check for next site sPattern = '<td class="thead">Zeige Themen .*?von ([^<]+)</td>' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): for aEntry in aResult[1]: iTotalCount = aEntry[0] iNextPage = int(iPage) + 1 iCurrentDisplayStart = __createDisplayStart(iNextPage) if (iCurrentDisplayStart < iTotalCount): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('parseMovieResultSite') oGuiElement.setTitle('next ..') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('iPage', iNextPage) oOutputParameterHandler.addParameter('normalySiteUrl', normalySiteUrl) normalySiteUrl = normalySiteUrl + str(iNextPage) oOutputParameterHandler.addParameter('siteUrl', normalySiteUrl) oOutputParameterHandler.addParameter('securityCookie', sSecurityValue) oGui.addFolder(oGuiElement, oOutputParameterHandler) 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('sUrl', URL_FAVOURITE_MOVIE_PAGE) oGui.addFolder(cGuiElement('Beliebteste Filme', SITE_IDENTIFIER, 'showFavItems'), oParams) oGui.setEndOfDirectory()
def load(): logger.info("Load %s" % SITE_NAME) # instanzieren eines Objekts der Klasse cGui zur Erstellung eines Menus oGui = cGui() # Menueintrag, durch Instanzierung eines Objekts der Klasse cGuiElement, erzeugen und zum Menu (oGui) hinzufügen oGui.addFolder(cGuiElement('Alle Serien', SITE_IDENTIFIER, 'showSeries')) oGui.addFolder(cGuiElement('A-Z', SITE_IDENTIFIER, 'showCharacters')) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch')) # Ende des Menus oGui.setEndOfDirectory()
def MoviesByYear(): oGui = cGui() params = ParameterHandler() params.setParam("sUrl", URL_CINEMA2015) oGui.addFolder(cGuiElement("Filme aus 2015", SITE_IDENTIFIER, "showEntries"), params) params.setParam("sUrl", URL_CINEMA2014) oGui.addFolder(cGuiElement("Filme aus 2014", SITE_IDENTIFIER, "showEntries"), params) params.setParam("sUrl", URL_CINEMA2013) oGui.addFolder(cGuiElement("Filme aus 2013", SITE_IDENTIFIER, "showEntries"), params) oGui.setEndOfDirectory()
def load(): logger.info("Load %s" % SITE_NAME) oGui = cGui() params = ParameterHandler() params.setParam('sUrl', URL_MOVIES) oGui.addFolder(cGuiElement('Filme', SITE_IDENTIFIER, 'showEntries'), params) params.setParam('sUrl', URL_SHOWS) oGui.addFolder(cGuiElement('Serien', SITE_IDENTIFIER, 'showEntries'), params) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch')) oGui.setEndOfDirectory()
def __parseMovieResultSite(oGui, siteUrl, normalySiteUrl = '', iPage = 1): if not normalySiteUrl: normalySiteUrl = siteUrl+'sortorder={0}&pp=200&p='.format(sortBy) params = ParameterHandler() sPattern = 'class="p1".*?<img class="large" src="(http://[^"]+)".*?<a href="[^"]+" id=".*?([^"_]+)"(.*?)>([^<]+)</a>(.*?)</tr>' sHtmlContent = __getHtmlContent(sUrl = siteUrl) # parse content oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == False): return total = len(aResult[1]) badwords = ['girl', 'giselle', 'she', 'tran', 'lady', 'sister', 'woman', 'bisex', 'madame', 'bi ', ' bi', 'schwan', 'false advertis', 'super ramon', ' ts', 'ts ', 'milf', 'mom', 'pussy', 'tit', 'boob', 'lesb', 'babe', 'doll', 'chick', 'rogue adventures', 'kuss den', 'overpowered by', 'surprise i have a dick'] isok = True for img, link, hdS, title, yearS in aResult[1]: isok = True for w in badwords: if title.lower().find(w) != -1: isok = False break if isok: sMovieTitle = title.replace('&','&') sTitle = sMovieTitle sUrl = URL_SHOW_MOVIE + str(link) year = '' aResult = oParser.parse(yearS, ' ([0-9]{4}) -') if aResult[0]: year = aResult[1][0] aResult = oParser.parse(hdS, '(title="HD Quali")') if aResult[0]: sTitle = sTitle + ' [HD]' oGuiElement = cGuiElement(sTitle,SITE_IDENTIFIER,'getHosters') oGuiElement.setMediaType('movie') oGuiElement.setYear(year) oGuiElement.setThumbnail(img) params.setParam('movieUrl', sUrl) params.setParam('sMovieTitle', sMovieTitle) oGui.addFolder(oGuiElement, params, bIsFolder = False, iTotal = total) else: isok = True npage = int(iPage)+1 # check for next site iTotalPages = __getTotalPages(iPage, sHtmlContent) if iTotalPages >= npage: params = ParameterHandler() params.setParam('iPage', npage) params.setParam('normalySiteUrl', normalySiteUrl) params.setParam('siteUrl', normalySiteUrl + str(npage)) oGui.addNextPage(SITE_IDENTIFIER,'parseMovieResultSite', params, iTotalPages) if iTotalPages > 1: oGuiElement = cGuiElement('#{0} Page [{0} of {1}]'.format(str(iPage), str(iTotalPages)),SITE_IDENTIFIER,'gotoPage') params = ParameterHandler() oGui.addFolder(oGuiElement, params) oGui.setView('movies')
def showRandom(): oGui = cGui() oParams = ParameterHandler() oGui.addFolder(cGuiElement('Zufällige Serie', SITE_IDENTIFIER, 'randomSerie')) oParams.setParam('specific', 'Season') oGui.addFolder(cGuiElement('Zufällige Staffel', SITE_IDENTIFIER, 'randomSeason'), oParams) oParams.setParam('specific', 'Episode') oGui.addFolder(cGuiElement('Zufällige Episode', SITE_IDENTIFIER, 'randomEpisode'), 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('sUrl', URL_FAVOURITE_DOCU_PAGE) oGui.addFolder(cGuiElement('Beliebteste Dokumentationen', SITE_IDENTIFIER, 'showFavItems'), oParams) oParams.setParam('sUrl', URL_LATEST_DOCU_PAGE) oGui.addFolder(cGuiElement('Neuste Dokumentationen', SITE_IDENTIFIER, 'showFavItems'), oParams) oGui.setEndOfDirectory()
def showSeriesMenu(): oGui = cGui() params = ParameterHandler() sType = params.getValue('sType') params.setParam('sUrl', URL_SERIES % sType) oGui.addFolder(cGuiElement('Neuste Serien', SITE_IDENTIFIER, 'showEntries'), params) params.setParam('sUrl', URL_SERIES_ASC % sType) oGui.addFolder(cGuiElement('Alle Serien', SITE_IDENTIFIER, 'showEntries'), params) oGui.setEndOfDirectory()
def showFilmlist(): oGui = cGui() params = ParameterHandler() for number in range(0, 10): # numbers from 0-9 params.setParam('sUrl', URL_LIST % str(number)) oGui.addFolder(cGuiElement(str(number), SITE_IDENTIFIER, 'showEntriesFilmlist'), params) import string for letter in string.uppercase[:26]: # letters from A-Z params.setParam('sUrl', URL_LIST % str(letter)) oGui.addFolder(cGuiElement(letter, SITE_IDENTIFIER, 'showEntriesFilmlist'), params) oGui.setEndOfDirectory()
def load(): logger.info("Load %s" % SITE_NAME) oGui = cGui() params = ParameterHandler() params.setParam('sUrl', URL_KINO) oGui.addFolder(cGuiElement('Aktuelle Kinofilme', SITE_IDENTIFIER, 'showEntries'), params) params.setParam('sUrl', URL_MAIN) oGui.addFolder(cGuiElement('Alle Filme', SITE_IDENTIFIER, 'showEntries'), params) oGui.addFolder(cGuiElement('Kategorien', SITE_IDENTIFIER, 'showCategory')) oGui.addFolder(cGuiElement('Suche', SITE_IDENTIFIER, 'showSearch')) oGui.setEndOfDirectory()
def __createMenuEntry(oGui, sFunction, sLabel, oOutputParameterHandler=''): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGui.addFolder(oGuiElement, oOutputParameterHandler)
def soir_epg(): #Code qui gerent l'epg oGuiElement = cGuiElement() oInputParameterHandler = cInputParameterHandler() sTitle = oInputParameterHandler.getValue('sMovieTitle') sCom = cePg().get_epg(sTitle, 'soir')
def listVideos(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() 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 = cOutputParameterHandler() oOutputParameterHandler.addParameter('sUrl', sUrl) oOutputParameterHandler.addParameter( 'playlistId', 'spieltagEinzeln') oGui.addFolder(oGuiElement, oOutputParameterHandler) #ältere Saison oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('listVideos') lastSaison = str(int(sSaison) - 1) oGuiElement.setTitle('*' + lastSaison + '*') sUrl = sUrl.replace(sSaison, lastSaison) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sUrl', sUrl) oOutputParameterHandler.addParameter('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 = cOutputParameterHandler() oOutputParameterHandler.addParameter('sUrl', sUrl) oOutputParameterHandler.addParameter( '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 = cOutputParameterHandler() oOutputParameterHandler.addParameter('sUrl', sUrl) oOutputParameterHandler.addParameter('sTitle', sTitle) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setView('movies') oGui.setEndOfDirectory()
def showTV(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() oParser = cParser() #sPattern = '<url>([^<>]+?)</url><title>([^<>]+?)</title><order>' + sOrder + '</order><icon>(.+?)</icon>' sPattern = '<title>(.+?)</title><link>(.+?)</link>' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): progress_ = progress().VScreate(SITE_NAME) #affiche par if (oInputParameterHandler.exist('AZ')): sAZ = oInputParameterHandler.getValue('AZ') string = filter( lambda t: t[0].strip().capitalize().startswith(sAZ), aResult[1]) string = sorted(string, key=lambda t: t[0].strip().capitalize()) else: string = sorted(aResult[1], key=lambda t: t[0].strip().capitalize()) total = len(string) for aEntry in string: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', aEntry[1]) oOutputParameterHandler.addParameter('sMovieTitle', aEntry[0]) oOutputParameterHandler.addParameter('sThumbnail', 'tv.png') oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('play__') oGuiElement.setTitle(aEntry[0]) oGuiElement.setFileName(aEntry[0]) oGuiElement.setIcon('tv.png') oGuiElement.setMeta(0) #oGuiElement.setThumbnail('tv.png') oGuiElement.setDirectTvFanart() oGuiElement.setCat(6) oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'direct_epg', 'Guide tv Direct') oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'soir_epg', 'Guide tv Soir') oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'enregistrement', 'Enregistrement') oGui.createContexMenuFav(oGuiElement, oOutputParameterHandler) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) oGui.setEndOfDirectory()
def showSeries(sSearch=''): oInputParameterHandler = cInputParameterHandler() iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') if sSearch: result = grab.getUrl('search/tv', '', 'query=' + sSearch) sUrl = '' else: sUrl = oInputParameterHandler.getValue('siteUrl') if (oInputParameterHandler.exist('genre')): term = 'with_genres=' + oInputParameterHandler.getValue('genre') else : term = '' result = grab.getUrl(sUrl, iPage, term) oGui = cGui() total = len(result) if (total > 0): for i in result['results']: sId, sTitle, sOtitle, sThumbnail, sFanart, sDesc = i['id'], i['name'], i['original_name'], i['poster_path'], i['backdrop_path'], i['overview'] if sThumbnail: sThumbnail = POSTER_URL + sThumbnail else: sThumbnail = '' if sFanart: sFanart = FANART_URL + sFanart else : sFanart = '' sTitle = sTitle.encode("utf-8") sSiteUrl = 'tv/' + str(sId) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sSiteUrl) oOutputParameterHandler.addParameter('sMovieTitle', str(sTitle)) oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail)) oOutputParameterHandler.addParameter('sId', str(sId)) oOutputParameterHandler.addParameter('sFanart', str(sFanart)) oOutputParameterHandler.addParameter('sTmdbId', i['id']) oOutputParameterHandler.addParameter('searchtext', sTitle) #oGui.addTVDB(SITE_IDENTIFIER, 'showSeriesSaison', sTitle, 'series.png', sThumbnail, sFanart, oOutputParameterHandler) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(i['id']) oGuiElement.setSiteName(SITE_IDENTIFIER) # a activer pour saisons #oGuiElement.setSiteName('globalSearch') # a desactiver pour saison oGuiElement.setFunction('showSeriesSaison') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGuiElement.setDescription(sDesc) oGui.addFolder(oGuiElement, oOutputParameterHandler) if (iPage > 0): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) oGui.addNext(SITE_IDENTIFIER, 'showSeries', '[COLOR teal]Page ' + str(iNextPage) + ' >>>[/COLOR]', oOutputParameterHandler) #test pr chnagement mode #xbmc.executebuiltin('Container.SetViewMode(500)') oGui.setEndOfDirectory(view)
def showSeriesEpisode(): oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sFanart = oInputParameterHandler.getValue('sFanart') sTmdbId = oInputParameterHandler.getValue('sTmdbId') sSeason = oInputParameterHandler.getValue('sSeason') #sId = oInputParameterHandler.getValue('sId') if sSeason == False: sSeason = sUrl.split('/')[-1] if sFanart == False: sFanart = '' oGui = cGui() #recherche saison complete oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle) oOutputParameterHandler.addParameter('type', 'serie') search = '%s S%02d' % (sMovieTitle, int(sSeason)) oOutputParameterHandler.addParameter('searchtext', search) oGui.addDir('cHome', 'showSearch', cConfig().getlanguage(30415), 'searchtmdb.png', oOutputParameterHandler) #fin result = grab.getUrl(sUrl) total = len(result) if (total > 0): for i in result['episodes']: #sId, sTitle, sOtitle, sThumbnail, sFanart = i['id'], i['name'], i['original_name'], i['poster_path'], i['backdrop_path'] sdate, sIdEp, sEpNumber, sName, sThumbnail, SResume = i['air_date'], i['id'], i['episode_number'], i['name'], i['still_path'], i['overview'] sName = sName.encode("utf-8") if sName == '': sName = sMovieTitle if sThumbnail: sThumbnail = POSTER_URL + sThumbnail else: sThumbnail = '' #sTitle = '[COLOR coral]S' + sSeason + 'E' + str(sEpNumber) + '[/COLOR] - ' + sName sTitle = 'S%s E%s %s' % (sSeason, str(sEpNumber) , sName) sExtraTitle = ' S' + "%02d" % int(sSeason) + 'E' + "%02d" % int(sEpNumber) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle + '|' + sExtraTitle) #Pour compatibilite Favoris oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail)) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) oOutputParameterHandler.addParameter('sSeason', sSeason) oOutputParameterHandler.addParameter('sEpisode', str(sEpNumber)) oOutputParameterHandler.addParameter('type', 'serie') oOutputParameterHandler.addParameter('searchtext', showTitle(sMovieTitle, sMovieTitle + '|' + sExtraTitle)) #oGui.addTVDB('globalSearch', 'showHosters', sTitle, 'series.png', sThumbnail, sFanart, oOutputParameterHandler) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sTmdbId) oGuiElement.setSiteName('cHome') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sMovieTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) #test pr chnagement mode #xbmc.executebuiltin('Container.SetViewMode(50)') oGui.setEndOfDirectory()
def showSeriesEpisode(): grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sFanart = oInputParameterHandler.getValue('sFanart') sTmdbId = oInputParameterHandler.getValue('sTmdbId') sSeason = oInputParameterHandler.getValue('sSeason') # sId = oInputParameterHandler.getValue('sId') if sSeason == False: sSeason = sUrl.split('/')[-1] if sFanart == False: sFanart = '' oGui = cGui() # recherche saison complete oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle) # oOutputParameterHandler.addParameter('type', 'serie') search = '%s S%02d' % (sMovieTitle, int(sSeason)) # oOutputParameterHandler.addParameter('searchtext', search) if not isMatrix(): oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(search)) else: oOutputParameterHandler.addParameter('searchtext', search) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('searchMovie') oGuiElement.setTitle(addons.VSlang(30415)) oGuiElement.setCat(2) oGuiElement.setIcon("searchtmdb.png") oGui.addFolder(oGuiElement, oOutputParameterHandler) result = grab.getUrl(sUrl) total = len(result) if (total > 0 and 'episodes' in result): total = len(result['episodes']) progress_ = progress().VScreate(SITE_NAME) oOutputParameterHandler = cOutputParameterHandler() for i in result['episodes']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break # sId, sTitle, sOtitle, sThumb, sFanart = i['id'], i['name'], i['original_name'], i['poster_path'], i['backdrop_path'] sEpNumber = i['episode_number'] # Mise en forme des infos (au format meta imdb) i = grab._format(i, '') sTitle, sGenre, sThumb, sFanart, sDesc, sYear = i['title'], i[ 'genre'], i['poster_path'], i['backdrop_path'], i['plot'], i[ 'year'] if not isMatrix(): sTitle = sTitle.encode("utf-8") sTitle = 'S%s E%s %s' % (sSeason, str(sEpNumber), sTitle) sExtraTitle = ' S' + "%02d" % int(sSeason) + 'E' + "%02d" % int( sEpNumber) oOutputParameterHandler.addParameter( 'siteUrl', sMovieTitle + '|' + sExtraTitle) # Pour compatibilite Favoris oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) oOutputParameterHandler.addParameter('sSeason', sSeason) oOutputParameterHandler.addParameter('sEpisode', sEpNumber) oOutputParameterHandler.addParameter('type', 'serie') if not isMatrix(): oOutputParameterHandler.addParameter( 'searchtext', cUtil().CleanName(sMovieTitle)) else: oOutputParameterHandler.addParameter('searchtext', sMovieTitle) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sTmdbId) oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sMovieTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumb) oGuiElement.setFanart(sFanart) oGuiElement.setCat(2) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) oGuiElement.setGenre(sGenre) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) # tchnagement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showActors(sSearch=''): oGui = cGui() grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') if (oInputParameterHandler.exist('sSearch')): sSearch = oInputParameterHandler.getValue('sSearch') if sSearch: # format obligatoire evite de modif le format de l'url dans la lib >> _call # a cause d'un ? pas ou il faut pour ça >> invalid api key result = grab.getUrl(sUrl, iPage, 'query=' + sSearch) else: result = grab.getUrl(sUrl, iPage) total = len(result) if (total > 0): total = len(result['results']) progress_ = progress().VScreate(SITE_NAME) oOutputParameterHandler = cOutputParameterHandler() # récup le nombre de page pour NextPage nbrpage = result['total_pages'] for i in result['results']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sName, sThumb = i['name'], i['profile_path'] if sThumb: POSTER_URL = grab.poster sThumb = POSTER_URL + sThumb else: sThumb = '' oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('sThumb', sThumb) if not isMatrix(): sName = sName.encode('utf-8') oOutputParameterHandler.addParameter( 'siteUrl', 'person/' + str(i['id']) + '/movie_credits') sTitle = str(sName) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showFilmActor') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sName) oGuiElement.setIcon('actors.png') oGuiElement.setMeta(0) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) if (int(iPage) < int(nbrpage)): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) # ajoute param sSearch pour garder le bon format d'url avec grab url if sSearch: oOutputParameterHandler.addParameter('sSearch', sSearch) oGui.addNext(SITE_IDENTIFIER, 'showActors', 'Page ' + str(iNextPage), oOutputParameterHandler) view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def ajaxCall(): oGui = cGui() metaOn = oGui.isMetaOn oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') if oParams.exist('page') and oParams.exist('mediaType'): iPage = oParams.getValue('page') sMediaType = oParams.getValue('mediaType') iMediaTypePageId = False if oParams.exist('mediaTypePageId'): iMediaTypePageId = oParams.getValue('mediaTypePageId') sCharacter = 'A' if oParams.exist('character'): sCharacter = oParams.getValue('character') logger.info('MediaType: ' + sMediaType + ' , Page: ' + str(iPage) + ' , iMediaTypePageId: ' + str(iMediaTypePageId) + ' , sCharacter: ' + str(sCharacter)) sHtmlContent = __getAjaxContent(sMediaType, iPage, iMediaTypePageId, metaOn, sCharacter) if not sHtmlContent: return if metaOn and not sMediaType == 'documentation': aData = loads(sHtmlContent)['aaData'] total = len(aData) oParser = cParser() for aEntry in aData: sPattern = '<a href="([^"]+)".*?onclick="return false;">([^<]+)<.*?>([0-9]{4})<' aResult = oParser.parse(aEntry[2], sPattern) if aResult[0]: sYear = str(aResult[1][0][2]).strip() sTitle = aResult[1][0][1] sLang = aEntry[0] sUrl = URL_MAIN + str(aResult[1][0][0]) sUrl = sUrl.replace('\\', '') oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'parseMovieEntrySite') oGuiElement.setYear(sYear) oGuiElement.setLanguage(sLang) oParams.setParam('sUrl', sUrl) if sMediaType == 'series': oGuiElement.setMediaType('tvshow') oGui.addFolder(oGuiElement, oParams, iTotal=total) else: oGuiElement.setMediaType('movie') oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=total) # check for next site sPattern = '"iTotalDisplayRecords":"([^"]+)' aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: for aEntry in aResult[1]: iTotalCount = aEntry[0] iNextPage = int(iPage) + 1 iCurrentDisplayStart = __createDisplayStart(iNextPage) if iCurrentDisplayStart < iTotalCount: oParams = ParameterHandler() oParams.setParam('page', iNextPage) oParams.setParam('character', sCharacter) oParams.setParam('mediaType', sMediaType) oParams.setParam('securityCookie', sSecurityValue) if iMediaTypePageId: oParams.setParam('mediaTypePageId', iMediaTypePageId) oGui.addNextPage(SITE_IDENTIFIER, 'ajaxCall', oParams) else: aData = loads(sHtmlContent) sPattern = '<div class="Opt leftOpt Headlne"><a title="(.*?)" href="(.*?)">.*?src="(.*?)".*?class="Descriptor">(.*?)</div.*?lng/(.*?).png' # parse content oParser = cParser() aResult = oParser.parse(aData['Content'].encode('utf-8'), sPattern) # iterated result and create GuiElements if aResult[0]: total = len(aResult[1]) for aEntry in aResult[1]: sMovieTitle, subLang = __checkSubLanguage(aEntry[0]) lang = __createLanguage(aEntry[4]) oGuiElement = cGuiElement(sMovieTitle, SITE_IDENTIFIER, 'parseMovieEntrySite') oGuiElement.setDescription(aEntry[3]) oGuiElement.setThumbnail(URL_MAIN + str(aEntry[2])) oGuiElement.setLanguage(lang) oGuiElement.setSubLanguage(subLang) oParams.setParam('sUrl', URL_MAIN + str(aEntry[1])) if sMediaType == 'series': oGui.addFolder(oGuiElement, oParams, iTotal=total) else: oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=total) # next page iTotalCount = int(aData['Total']) iNextPage = int(iPage) + 1 if __createDisplayStart(iNextPage) < iTotalCount: oParams = ParameterHandler() oParams.setParam('page', iNextPage) if iMediaTypePageId: oParams.setParam('mediaTypePageId', iMediaTypePageId) oGui.addNextPage(SITE_IDENTIFIER, 'ajaxCall', oParams) if sMediaType == 'series': oGui.setView('tvshows') else: oGui.setView('movies') oGui.setEndOfDirectory()
def parseNews(): oGui = cGui() oParams = ParameterHandler() sSecurityValue = oParams.getValue('securityCookie') sUrl = oParams.getValue('sUrl') sNewsTitle = oParams.getValue('sNewsTitle') oParser = cParser() aResult = oParser.parse(sNewsTitle, 'Neue (.*?) online') if aResult[0]: if str(aResult[1][0]) == 'Serien': mediaType = 'series' else: mediaType = 'movie' sPattern = '<div class="Opt leftOpt Headlne"><h1>' + sNewsTitle \ + '</h1></div>(.*?)<div class="ModuleFooter">' sHtmlContent = __getHtmlContent(sUrl=sUrl, sSecurityValue=sSecurityValue) aResult = oParser.parse(sHtmlContent, sPattern) if not aResult[0]: logger.info("Can't get any news") oGui.setEndOfDirectory() return sPattern = '<td class="Icon"><img src="/gr/sys/lng/(\d+).png" alt="language" width="16" ' + \ 'height="11".*?<td class="Title.*?rel="([^"]+)"><a href="([^\"]+)".*?class="OverlayLabel">([^<]+)<' + \ '(span class="EpisodeDescr">)?([^<]+)' aResult = oParser.parse(aResult[1][0], sPattern) if not aResult[0]: logger.info("Can't get any news") oGui.setEndOfDirectory() return total = len(aResult[1]) # Create an entry for every news line for aEntry in aResult[1]: sLang = __createLanguage(aEntry[0]) sTitle = aEntry[3] if sTitle.endswith(':'): sTitle = sTitle[:-1] sTitle, subLang = __checkSubLanguage(sTitle) sUrl = aEntry[2] # If there are several urls, just pick the first one aUrl = sUrl.split(",") if len(aUrl) > 0: sUrl = aUrl[0] oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'parseMovieEntrySite') oGuiElement.setLanguage(sLang) oGuiElement.setSubLanguage(subLang) oGuiElement.setThumbnail(URL_MAIN + str(aEntry[1])) oParams.setParam('sUrl', URL_MAIN + sUrl) oParams.setParam('mediaType', mediaType) if mediaType == 'series': oGuiElement.setMediaType('tvshow') oGui.addFolder(oGuiElement, oParams, iTotal=total) oGui.setView('tvshows') else: oGuiElement.setMediaType('movie') oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=total) oGui.setView('movies') oGui.setEndOfDirectory()
def showAllPlaylist(): #On recupere les differentes playlist si il y en a oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumb = oInputParameterHandler.getValue('sThumbnail') sDesc = oInputParameterHandler.getValue('sDescription') #VSlog(str(sUrl)) if 'firstonetv' and 'Register-Login' in sUrl: session = requests.Session() url = 'https://www.firstonetv.net/Register-Login' data = { 'usrmail': ADDON.getSetting('hoster_firstonetv_username'), 'password': ADDON.getSetting('hoster_firstonetv_password'), 'login': '******' } headers = { 'user-agent': UA, 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': 'https://www.firstonetv.net/Index', 'Content-Length': str(len(data)) } session.post(url, data=data, headers=headers) cookiesDict = requests.utils.dict_from_cookiejar(session.cookies) getUser = re.match("{'(.+?)': '(.+?)',", str(cookiesDict)) #VSlog(cookiesDict) cookies = str(getUser.group(1)) + '=' + str(getUser.group(2)) GestionCookie().SaveCookie('firstonetv', cookies) dialog().VSinfo('Authentification réussie merci de recharger la page', 'FirstOneTv', 15) return sHtmlContent = getHtml(sUrl) if 'myfree-tivi' in sUrl: aResult = re.findall('<meta name="csrf-token" content="(.+?)">', sHtmlContent) if aResult: token = aResult[0] #VSlog(token) sHtmlContent = getHtml(sUrl, token) if 'firstonetv' in sUrl: sPattern = '(?:"surl":"{\".+?|,.+?)"([^"]+)\".+?"http([^"]+).m3u8' elif 'myfree-tivi' in sUrl: sPattern = 'url".+?"(.+?)".+?title.+?"(.+?)".+?thumb".+?"(.+?)"' elif 'iptvgratuit.com' in sUrl: sPattern = '<h4><a class="more-link" title="(.+?)" href="(.+?)" target="_blank" rel="noopener"><button>.+?</button></a></h4>' elif 'dailyiptvlist.com' in sUrl: sPattern = '<p></br><br /><strong>2. Click on link to download .+? iptv channels list</strong></p>\s*.+?<a href="(.+?)">Download (.+?)</a>' elif 'iptvsource.com': sPattern = '<a href="([^"]+)">Download as([^"]+)</a>' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): total = len(aResult[1]) progress_ = progress().VScreate(SITE_NAME) for aEntry in aResult[1]: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break if 'firstonetv' in sUrl: sTitle = sTitle + aEntry[0] sDesc = sDesc sThumb = sThumb sUrl2 = 'http' + aEntry[1].replace('\\\/', '/').replace( '\/', '/' ) + '.m3u8|Referer=' + sUrl + '&User-Agent=' + UA + '&X-Requested-With=ShockwaveFlash/28.0.0.137&Origin=https://www.firstonetv.net' elif 'myfree-tivi' in sUrl: sTitle = str(aEntry[1]) sUrl2 = aEntry[0].replace('\\\/', '/').replace("\/", "/") sThumb = 'https:' + str(aEntry[2]).replace( '\\\/', '/').replace('\/', '/') sDesc = '' elif 'iptvgratuit.com' in sUrl: sTitle = aEntry[0] sUrl2 = aEntry[1] sThumb = '' sDesc = '' else: sTitle = aEntry[1] sUrl2 = aEntry[0] sThumb = '' sDesc = '' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl2) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) if 'myfree-tivi' or 'firstonetv' in sUrl: oOutputParameterHandler.addParameter('sThumbnail', sThumb) if 'iptvgratuit' and 'world-iptv-links' in sUrl: oGui.addDir(SITE_IDENTIFIER, 'showWorldIptvGratuit', sTitle, '', oOutputParameterHandler) elif 'firstonetv' in sUrl or 'myfree-tivi' in sUrl: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('play__') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon(sThumb) oGuiElement.setMeta(0) oGuiElement.setThumbnail(sThumb) oGuiElement.setDirectTvFanart() oGuiElement.setCat(6) oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'direct_epg', 'Guide tv Direct') oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'soir_epg', 'Guide tv Soir') oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'enregistrement', 'Enregistrement') oGui.createContexMenuFav(oGuiElement, oOutputParameterHandler) oGui.addFolder(oGuiElement, oOutputParameterHandler) else: oGui.addDir(SITE_IDENTIFIER, 'showWeb', sTitle, '', oOutputParameterHandler) progress_.VSclose(progress_) oGui.setEndOfDirectory()
def ajaxCall(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sSecurityValue = oInputParameterHandler.getValue('securityCookie') if (oInputParameterHandler.exist('page') and oInputParameterHandler.exist('mediaType')): iPage = oInputParameterHandler.getValue('page') sMediaType = oInputParameterHandler.getValue('mediaType') iMediaTypePageId = False if (oInputParameterHandler.exist('mediaTypePageId')): iMediaTypePageId = oInputParameterHandler.getValue('mediaTypePageId') sCharacter = 'A' if (oInputParameterHandler.exist('character')): sCharacter = oInputParameterHandler.getValue('character') logger.info('MediaType: ' + sMediaType + ' , Page: ' + str(iPage) + ' , iMediaTypePageId: ' + str(iMediaTypePageId) + ' , sCharacter: ' + str(sCharacter)) sAjaxUrl = __createAjaxUrl(sMediaType, iPage, iMediaTypePageId, sCharacter) logger.info(sAjaxUrl) sHtmlContent = __getHtmlContent(sUrl=sAjaxUrl) aData = loads(sHtmlContent)['aaData'] for aEntry in aData: sPattern = '<a href="([^"]+)".*?onclick="return false;">([^<]+)' oParser = cParser() aResult = oParser.parse(aEntry[2], sPattern) if aResult[0]: sTitle = __createTitleWithLanguage( aEntry[0], aResult[1][0][1]).encode('utf-8') sUrl = URL_MAIN + str(aResult[1][0][0]) sUrl = sUrl.replace('\\', '') __createMenuEntry(oGui, 'parseMovieEntrySite', sTitle, [['sUrl', sUrl], ["securityCookie", sSecurityValue]]) # check for next site sPattern = '"iTotalDisplayRecords":"([^"]+)' aResult = oParser.parse(sHtmlContent, sPattern) if aResult[0]: for aEntry in aResult[1]: iTotalCount = aEntry[0] iNextPage = int(iPage) + 1 iCurrentDisplayStart = __createDisplayStart(iNextPage) if (iCurrentDisplayStart < iTotalCount): oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('ajaxCall') oGuiElement.setTitle('next ..') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('page', iNextPage) oOutputParameterHandler.addParameter('character', sCharacter) oOutputParameterHandler.addParameter('mediaType', sMediaType) oOutputParameterHandler.addParameter('securityCookie', sSecurityValue) if iMediaTypePageId: oOutputParameterHandler.addParameter('mediaTypePageId', iMediaTypePageId) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setView('movies') oGui.setEndOfDirectory()
def showActors(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') result = grab.getUrl(sUrl, iPage) total = len(result) if (total > 0): for i in result['results']: sName, sThumbnail = i['name'], i['profile_path'] if sThumbnail: sThumbnail = POSTER_URL + sThumbnail else: sThumbnail = '' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', str(sUrl)) oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail)) sName = sName.encode('utf-8') oOutputParameterHandler.addParameter('siteUrl', 'person/' + str(i['id']) + '/movie_credits') #oGui.addMovieDB(SITE_IDENTIFIER, 'showFilmActor', '[COLOR red]'+str(sName)+'[/COLOR]', '', sThumbnail, '', oOutputParameterHandler) sTitle = '[COLOR red]' + str(sName) + '[/COLOR]' oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showFilmActor') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sName) oGuiElement.setIcon('actors.png') oGuiElement.setMeta(0) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) for e in i['known_for']: try: sTitle = unicodedata.normalize('NFKD', e['title']).encode('ascii','ignore') except: sTitle = "Aucune information" sId = e['id'] try: sFanart = FANART_URL+e['backdrop_path'] except: sFanart = '' try: sThumbnail = POSTER_URL+e['poster_path'] except: sThumbnail = '' #sTitle = sTitle.encode("utf-8") oOutputParameterHandler.addParameter('siteUrl', 'none') oOutputParameterHandler.addParameter('sMovieTitle', str(sTitle)) oOutputParameterHandler.addParameter('sTmdbId', sId) oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail)) oOutputParameterHandler.addParameter('type', 'film') oOutputParameterHandler.addParameter('searchtext', showTitle(sTitle, str('none'))) #oGui.addMovieDB('globalSearch', 'showHosters', sTitle, '', sThumbnail, sFanart, oOutputParameterHandler) oGuiElement = cGuiElement() oGuiElement.setTmdbId(sId) oGuiElement.setSiteName('cHome') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('actors.png') oGuiElement.setMeta(0) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) if (iPage > 0): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) oGui.addNext(SITE_IDENTIFIER, 'showActors', '[COLOR teal]Page ' + str(iNextPage) + ' >>>[/COLOR]', oOutputParameterHandler) oGui.setEndOfDirectory()
def showSeriesSaison(): oGui = cGui() grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sFanart = oInputParameterHandler.getValue('sFanart') sTmdbId = oInputParameterHandler.getValue('sTmdbId') sId = oInputParameterHandler.getValue('sId') if sId == False: sId = sUrl.split('/')[-1] if sFanart == False: sFanart = '' # recherche la serie complete oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle) # oOutputParameterHandler.addParameter('type', 'serie') # oOutputParameterHandler.addParameter('searchtext', sMovieTitle) if not isMatrix(): oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sMovieTitle)) else: oOutputParameterHandler.addParameter('searchtext', sMovieTitle) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('searchMovie') oGuiElement.setTitle(addons.VSlang(30414)) oGuiElement.setCat(2) oGuiElement.setIcon("searchtmdb.png") oGui.addFolder(oGuiElement, oOutputParameterHandler) result = grab.getUrl(sUrl) total = len(result) if (total > 0): total = len(result['seasons']) progress_ = progress().VScreate(SITE_NAME) oOutputParameterHandler = cOutputParameterHandler() for i in result['seasons']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sNbreEp, SSeasonNum = i['episode_count'], i['season_number'] # Mise en forme des infos (au format meta imdb) i = grab._format(i, '', "season") sTitle, sGenre, sThumb, sFanart, sDesc, sYear = i['title'], i[ 'genre'], i['poster_path'], i['backdrop_path'], i['plot'], i[ 'year'] sTitle = 'Saison ' + str(SSeasonNum) + ' (' + str(sNbreEp) + ')' sUrl = 'tv/' + str(sId) + '/season/' + str(SSeasonNum) oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sSeason', SSeasonNum) oOutputParameterHandler.addParameter('sFanart', sFanart) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sTmdbId) oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showSeriesEpisode') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sMovieTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) oGuiElement.setGenre(sGenre) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) # changement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showSeriesSaison(): oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sFanart = oInputParameterHandler.getValue('sFanart') sTmdbId = oInputParameterHandler.getValue('sTmdbId') sId = oInputParameterHandler.getValue('sId') if sId == False: sId = sUrl.split('/')[-1] if sFanart == False: sFanart = '' oGui = cGui() #recherche la serie complete oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle) oOutputParameterHandler.addParameter('type', 'serie') oOutputParameterHandler.addParameter('searchtext', sMovieTitle) oGui.addDir('cHome', 'showSearch', cConfig().getlanguage(30414), 'searchtmdb.png', oOutputParameterHandler) #fin result = grab.getUrl(sUrl) total = len(result) if (total > 0): for i in result['seasons']: sdate, sNbreEp, sIdSeason, sThumbnail, SSeasonNum = i['air_date'], i['episode_count'], i['id'], i['poster_path'], i['season_number'] if sThumbnail: sThumbnail = POSTER_URL+sThumbnail else: sThumbnail = '' sTitle = 'Saison ' + str(SSeasonNum) + ' (' + str(sNbreEp) + ')' sUrl = 'tv/' + sId + '/season/' + str(SSeasonNum) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail)) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sSeason', str(SSeasonNum)) oOutputParameterHandler.addParameter('sFanart', str(sFanart)) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) #oGui.addTVDB(SITE_IDENTIFIER, 'showSeriesEpisode', sTitle, 'series.png', sThumbnail, sFanart, oOutputParameterHandler) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sTmdbId) oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showSeriesEpisode') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sMovieTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) #test pr chnagement mode #xbmc.executebuiltin('Container.SetViewMode(500)') oGui.setEndOfDirectory()
def showSeries(sSearch=''): grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() iPage = 1 term = '' if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') if (oInputParameterHandler.exist('sSearch')): sSearch = oInputParameterHandler.getValue('sSearch') if sSearch: result = grab.getUrl('search/tv', iPage, 'query=' + sSearch) sUrl = '' else: sUrl = oInputParameterHandler.getValue('siteUrl') if (oInputParameterHandler.exist('genre')): term = 'with_genres=' + oInputParameterHandler.getValue('genre') if (oInputParameterHandler.exist('session_id')): term += 'session_id=' + oInputParameterHandler.getValue( 'session_id') result = grab.getUrl(sUrl, iPage, term) oGui = cGui() try: total = len(result) if (total > 0): total = len(result['results']) progress_ = progress().VScreate(SITE_NAME) for i in result['results']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break # Mise en forme des infos (au format meta imdb) i = grab._format(i, '', "tvshow") sId, sTitle, sGenre, sThumb, sFanart, sDesc, sYear = i[ 'tmdb_id'], i['title'], i['genre'], i['poster_path'], i[ 'backdrop_path'], i['plot'], i['year'] if not isMatrix(): sTitle = sTitle.encode("utf-8") sSiteUrl = 'tv/' + str(sId) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sSiteUrl) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sFanart', sFanart) oOutputParameterHandler.addParameter('sTmdbId', sId) if isMatrix(): oOutputParameterHandler.addParameter('searchtext', sTitle) else: oOutputParameterHandler.addParameter( 'searchtext', cUtil().CleanName(sTitle)) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sId) oGuiElement.setSiteName( SITE_IDENTIFIER) # a activer pour saisons oGuiElement.setFunction('showSeriesSaison') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setFanart(sFanart) oGuiElement.setCat(2) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) oGuiElement.setGenre(sGenre) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) if (int(iPage) > 0): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) if sSearch: oOutputParameterHandler.addParameter('sSearch', sSearch) if (oInputParameterHandler.exist('genre')): oOutputParameterHandler.addParameter( 'genre', oInputParameterHandler.getValue('genre')) oGui.addNext(SITE_IDENTIFIER, 'showSeries', 'Page ' + str(iNextPage), oOutputParameterHandler) except TypeError: oGui.addText(SITE_IDENTIFIER, '[COLOR red]Aucun résultat n\'a été trouvé.[/COLOR]') # changement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showMovies(sSearch = ''): oInputParameterHandler = cInputParameterHandler() iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') if sSearch: result = grab.getUrl('search/movie', '', 'query=' + sSearch) sUrl = '' else: sUrl = oInputParameterHandler.getValue('siteUrl') result = grab.getUrl(sUrl, iPage) oGui = cGui() total = len(result) if (total > 0): for i in result['results']: sId, sTitle, sOtitle, sThumbnail, sFanart, sDesc = i['id'], i['title'], i['original_title'], i['poster_path'], i['backdrop_path'], i['overview'] if sThumbnail: sThumbnail = POSTER_URL + sThumbnail else: sThumbnail = '' sTitle = sTitle.encode("utf-8") if sFanart: sFanart = FANART_URL + sFanart else : sFanart = '' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oOutputParameterHandler.addParameter('sMovieTitle', str(sTitle)) oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail)) oOutputParameterHandler.addParameter('sTmdbId', i['id']) oOutputParameterHandler.addParameter('type', 'film') oOutputParameterHandler.addParameter('searchtext', showTitle(sTitle, str('none'))) #oGui.addMovieDB('globalSearch', 'showHosters', sTitle, 'films.png', sThumbnail, sFanart, oOutputParameterHandler) cGui.CONTENT = "movies" oGuiElement = cGuiElement() oGuiElement.setTmdbId(i['id']) oGuiElement.setSiteName('cHome') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('films.png') oGuiElement.setMeta(1) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGuiElement.setDescription(sDesc) oGui.addFolder(oGuiElement, oOutputParameterHandler) if (iPage > 0): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) oGui.addNext(SITE_IDENTIFIER, 'showMovies', '[COLOR teal]Page ' + str(iNextPage) + ' >>>[/COLOR]', oOutputParameterHandler) #test pr chnagement mode #xbmc.executebuiltin('Container.SetViewMode(500)') oGui.setEndOfDirectory(view)
def showHoster(self, oGui, oHoster, sMediaUrl, sThumbnail, bGetRedirectUrl=False): oInputParameterHandler = cInputParameterHandler() oGuiElement = cGuiElement() oGuiElement.setSiteName(self.SITE_NAME) # oGuiElement.setFunction('showHosterMenu') oGuiElement.setFunction('play') oGuiElement.setTitle(oHoster.getDisplayName()) # oGuiElement.setThumbnail(sThumbnail) # if (oInputParameterHandler.exist('sMeta')): # sMeta = oInputParameterHandler.getValue('sMeta') # oGuiElement.setMeta(int(sMeta)) oGuiElement.setFileName(oHoster.getFileName()) oGuiElement.getInfoLabel() if sThumbnail: oGuiElement.setThumbnail(sThumbnail) # oGuiElement.setMeta(1) oGuiElement.setIcon('host.png') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sMediaUrl', sMediaUrl) oOutputParameterHandler.addParameter('sHosterIdentifier', oHoster.getPluginIdentifier()) oOutputParameterHandler.addParameter('bGetRedirectUrl', bGetRedirectUrl) oOutputParameterHandler.addParameter('sFileName', oHoster.getFileName()) oOutputParameterHandler.addParameter('sTitleWatched', oGuiElement.getTitleWatched()) oOutputParameterHandler.addParameter('sTitle', oHoster.getDisplayName()) oOutputParameterHandler.addParameter('sId', 'cHosterGui') oOutputParameterHandler.addParameter('siteUrl', sMediaUrl) # oOutputParameterHandler.addParameter('sFav', 'play') # oOutputParameterHandler.addParameter('sCat', '4') # nouveaux pour la lecture. if oInputParameterHandler.exist('sCat'): sCat = oInputParameterHandler.getValue('sCat') oGuiElement.setCat(sCat) oOutputParameterHandler.addParameter('sCat', sCat) else: oGuiElement.setCat('4') # context playlit menu oContext = cContextElement() oContext.setFile('cHosterGui') oContext.setSiteName(self.SITE_NAME) oContext.setFunction('addToPlaylist') oContext.setTitle(self.ADDON.VSlang(30201)) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) # Download menu if oHoster.isDownloadable(): oContext = cContextElement() oContext.setFile('cDownload') oContext.setSiteName('cDownload') oContext.setFunction('AddtoDownloadList') oContext.setTitle(self.ADDON.VSlang(30202)) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) if oHoster.isDownloadable(): # Beta context download and view menu oContext = cContextElement() oContext.setFile('cDownload') oContext.setSiteName('cDownload') oContext.setFunction('AddtoDownloadListandview') oContext.setTitle(self.ADDON.VSlang(30326)) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) # Upload menu uptobox if cInputParameterHandler().getValue('site') != 'siteuptobox' and self.ADDON.getSetting('hoster_uptobox_premium') == 'true': host = oHoster.getPluginIdentifier() accept = ['uptobox', 'uptostream', 'onefichier', 'uploaded', 'uplea'] for i in accept: if host == i: oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'siteuptobox', 'siteuptobox', 'UptomyAccount', self.ADDON.VSlang(30325)) # onefichier if cInputParameterHandler().getValue('site') != 'siteonefichier' and self.ADDON.getSetting('hoster_onefichier_premium') == 'true': host = oHoster.getPluginIdentifier() accept = 'onefichier' # les autres ne fonctionnent pas if host == accept: oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'siteonefichier', 'siteonefichier', 'UptomyAccount', '1fichier') # context FAV menu oGui.createContexMenuFav(oGuiElement, oOutputParameterHandler) # context Library menu oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cLibrary', 'cLibrary', 'setLibrary', self.ADDON.VSlang(30324)) # bug oGui.addHost(oGuiElement, oOutputParameterHandler)
def showLinks(sSearch='', channel=''): oGui = cGui() if sSearch: sUrl = sSearch sMovieTitle = 'Chaine ' + channel else: oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sPattern = '<iframe src="(http://www.bein.+?)"' aResult = __getUrl(sUrl, sPattern, Referer) if (aResult[0] == True): for aEntry in aResult[1]: sUrl = aEntry sUrl = sUrl.replace('lecteur.php?id=', 'stream/ch') + '.php' sPattern = '<script type="text/javascript" src="(.+?)">' aResult = __getUrl(sUrl, sPattern, Referer) if (aResult[0] == True): sUrl = aResult[1][0] sUrl = sUrl.replace('http://www.hdmyt.info/channel', 'http://www.playerhd2.pw/channel') sPattern = '<iframe src="(http://www.playerhd2.pw.+?)"' aResult = __getUrl(sUrl, sPattern, Referer2) else: return if (aResult[0] == True): sLink = 'noLink' round3 = 0 while ('noLink' in sLink): round3 = round3 + 1 sUrl = aResult[1][0] sPattern = '<input type="hidden" id=".+?" value="([a-zA-Z0-9=+/]+)"\s/>' aResult2 = __getUrl(sUrl, sPattern, Referer2) if (round3 > 10): sLink = 'LinkOFF' if (aResult2[0] == True): for aEntry in aResult2[1]: content = len(aEntry) if (content > 20): link = base64.b64decode(aEntry) link2 = base64.b64decode(link) link3 = base64.b64decode(link2) if '.m3u8' in link3: sLink = link3 sUrl = sLink + '|Referer=http://www.playerhd2.pw/jwplayer6/jwplayer.flash.swf&User-Agent=Mozilla/5.0 (X11; Linux i686; rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0' sThumbnail = sThumb oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sMovieTitle) oGuiElement.setMediaUrl(sUrl) oGuiElement.setThumbnail(sThumbnail) oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) oPlayer.startPlayer() return else: return if not sSearch: oGui.setEndOfDirectory()
def getDownloadList(self): #from resources.lib.downloadplay import download_and_play ##download_and_play('https://a-2.1fichier.com/c2290838997?inline','test.avi','D:\Temporaire') #download_and_play('https://1fichier.com/?56eplh6nth','test.avi','D:\Temporaire') #return oGui = cGui() oInputParameterHandler = cInputParameterHandler() row = cDb().get_Download() for data in row: title = data[1] url = urllib.unquote_plus(data[2]) cat = data[4] thumbnail = data[5] size = data[6] totalsize = data[7] status = data[8] path = data[3] oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sUrl', url) oOutputParameterHandler.addParameter('sMovieTitle', title) oOutputParameterHandler.addParameter('sThumbnail', thumbnail) oOutputParameterHandler.addParameter('sPath', path) oOutputParameterHandler.addParameter('sStatus', status) if status == '0': sStatus = '' elif status == '1': sStatus = '[COLOR=red][En cours] [/COLOR]' elif status == '2': sStatus = '[COLOR=green][Fini] [/COLOR]' if size: sTitle = sStatus + title + ' (' + self.__formatFileSize( size) + '/' + self.__formatFileSize(totalsize) + ')' else: sTitle = sStatus + title oGuiElement = cGuiElement() if not thumbnail or thumbnail == 'False': thumbnail = "mark.png" oGuiElement.setSiteName(SITE_IDENTIFIER) if status == '2': oGuiElement.setFunction('ReadDownload') else: #oGuiElement.setFunction('StartDownloadOneFile') #marche pas a cause de fenetre xbmc oGuiElement.setFunction('ReadDownload') oGuiElement.setTitle(sTitle) oGuiElement.setIcon('download.png') oGuiElement.setFanart(cConfig().getRootArt() + 'download_fanart.jpg') oGuiElement.setMeta(0) oGuiElement.setThumbnail(thumbnail) oGui.createContexMenuDownload(oGuiElement, oOutputParameterHandler, status) oGui.addFolder(oGuiElement, oOutputParameterHandler, False) oGui.setEndOfDirectory() return
def showHosters(): oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() oParser = cParser() sPattern = 'src="(http:\/\/media\.vimple\.me.+?)"' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): sUrl2 = aResult[1][0] oRequestHandler = cRequestHandler(sUrl2) oRequestHandler.addHeaderEntry( 'User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0' ) oRequestHandler.addHeaderEntry('Referer', sUrl) sHtmlContent = oRequestHandler.request() sPattern = '<source.+?src="([^"]+)"' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): cGui().showInfo('Info', 'Chargement film', 5) web_url = 'http://media.vimple.me/playerk.swf/' + aResult[1][0] sHosterUrl = web_url oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sMovieTitle) oGuiElement.setMediaUrl(sHosterUrl) oGuiElement.setThumbnail(sThumbnail) oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) oPlayer.startPlayer() else: oGui = cGui() sHtmlContent = oParser.abParse(sHtmlContent, "<script>", "</script><script>") sPattern = 'eval\s*\(\s*function(?:.|\s)+?{}\)\)' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): sHtmlContent = cPacker().unpack(aResult[1][0]) sHtmlContent = sHtmlContent.replace('\\', '') code = re.search('(https://openload.+?embed\/.+?\/)', sHtmlContent) if code: sHosterUrl = code.group(1) oHoster = cHosterGui().checkHoster(sHosterUrl) if (oHoster != False): oHoster.setDisplayName(sMovieTitle) oHoster.setFileName(sMovieTitle) cHosterGui().showHoster(oGui, oHoster, sHosterUrl, '') oGui.setEndOfDirectory()
def showEntries(searchString='', sGui=False): oGui = sGui if sGui else cGui() params = ParameterHandler() order = params.getValue('order') type = params.getValue('type') genre = params.getValue('genre') if not type: type = '' if not order: order = 'titleAsc' if not genre: genre = '' hasToken, token = __getToken() if not hasToken: if not sGui: oGui.showError('xStream', 'Es wurde kein Token gefunden.') return iPage = int(params.getValue('page')) if iPage <= 0: iPage = 1 sUrl = URL_LIST % (token, 25, iPage, order, genre, type, searchString) sJson = cRequestHandler(sUrl, ignoreErrors=(sGui is not False)).request() if not sJson: if not sGui: oGui.showError('xStream', 'Fehler beim Laden der Daten.') return aJson = json.loads(sJson) if not 'items' in aJson or len(aJson['items']) == 0: if not sGui: oGui.showInfo('xStream', 'Es wurde kein Eintrag gefunden') return isTvShowfound = False total = len(aJson['items']) for item in aJson["items"]: if 'link' not in item or len(item['link']) == 0: continue isTvshow = True if item['type'] == 'series' else False if isTvshow: isTvShowfound = True oGuiElement = cGuiElement(item['title'].encode('utf-8'), SITE_IDENTIFIER, 'showHosters') oGuiElement.setMediaType('tvshow' if isTvshow else 'movie') oGuiElement.setThumbnail(item['poster']) oGuiElement.setYear(item['year']) oGuiElement.setDescription(item['plot']) if item['runtime']: oGuiElement.addItemValue('duration', int(item['runtime']) * 60) if isTvshow: oGuiElement.setFunction('showSeasons') oGuiElement.setTVShowTitle(item['title'].encode('utf-8')) params.setParam('title_id', item['id']) params.setParam('sUrl', sUrl) oGui.addFolder(oGuiElement, params, isTvshow, total) if not sGui: if float(aJson["totalPages"]) > iPage: params.setParam('page', (iPage + 1)) oGui.addNextPage(SITE_IDENTIFIER, 'showEntries', params) oGui.setView('tvshows' if isTvShowfound else 'movies') oGui.setEndOfDirectory()
def AddtoDownloadListandview(self): oInputParameterHandler = cInputParameterHandler() sHosterIdentifier = oInputParameterHandler.getValue( 'sHosterIdentifier') sMediaUrl = oInputParameterHandler.getValue('sMediaUrl') sFileName = oInputParameterHandler.getValue('sFileName') cConfig().log("Telechargement " + sMediaUrl) meta = {} meta['url'] = sMediaUrl meta['cat'] = oInputParameterHandler.getValue('sCat') meta['title'] = sFileName meta['icon'] = xbmc.getInfoLabel('ListItem.Art(thumb)') if (self.AddDownload(meta)): #Si pas de telechargement en cours on lance le notre if not self.isDownloading(): row = cDb().get_Download(meta) if row: title = row[0][1] url = urllib.unquote_plus(row[0][2]) path = row[0][3] thumbnail = row[0][4] status = row[0][8] if (self.download(url, title, path, True) == True): #Download in fastmode #ok on attend un peu, et on lance le stream tempo = 100 dialog = cConfig().createDialog('Creation buffer') while (tempo > 0): #if canceled do nothing if dialog.iscanceled(): return cConfig().updateDialog(dialog, 100) tempo = tempo - 1 xbmc.sleep(500) cConfig().finishDialog(dialog) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setMediaUrl(path) oGuiElement.setTitle(title) #oGuiElement.getInfoLabel() oPlayer = cPlayer() if not (sys.argv[1] == '-1'): oPlayer.run(oGuiElement, title, path) else: oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) oPlayer.startPlayer() else: cConfig().showInfo('Echec du telechargement', 'Erreur') return
def direct_epg(): #Code qui gerent l'epg oGuiElement = cGuiElement() oInputParameterHandler = cInputParameterHandler() #aParams = oInputParameterHandler.getAllParameter() sTitle = oInputParameterHandler.getValue('sMovieTitle') sCom = cePg().get_epg(sTitle, 'direct')
def showLists(): oGui = cGui() grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') sUrl = oInputParameterHandler.getValue('siteUrl') result = grab.getUrl('list/' + sUrl, iPage, '') total = len(result) if (total > 0): total = len(result['items']) progress_ = progress().VScreate(SITE_NAME) oOutputParameterHandler = cOutputParameterHandler() for i in result['items']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break # Mise en forme des infos (au format meta imdb) i = grab._format(i, '') sId, sTitle, sType, sThumb, sFanart, sVote, sDesc, sYear = i[ 'tmdb_id'], i['title'], i['media_type'], i['poster_path'], i[ 'backdrop_path'], i['rating'], i['plot'], i['year'] if not isMatrix(): sTitle = sTitle.encode("utf-8") sDisplayTitle = "%s (%s)" % (sTitle, sVote) oOutputParameterHandler.addParameter('siteUrl', 'http://tmdb/%s' % sId) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sFanart', sFanart) oOutputParameterHandler.addParameter('sTmdbId', sId) if isMatrix(): oOutputParameterHandler.addParameter('searchtext', sTitle) else: oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sTitle)) cGui.CONTENT = "movies" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sId) oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sDisplayTitle) oGuiElement.setFileName(sTitle) if sType == 'movie': oGuiElement.setIcon('films.png') oGuiElement.setMeta(1) oGuiElement.setCat(1) elif sType == 'tv': oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setCat(2) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setFanart(sFanart) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) if 'genre' in i: oGuiElement.setGenre(i['genre']) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showHoster(self, oGui, oHoster, sMediaUrl, sThumbnail, bGetRedirectUrl=False): oInputParameterHandler = cInputParameterHandler() aParams = oInputParameterHandler.getAllParameter() oGuiElement = cGuiElement() oGuiElement.setSiteName(self.SITE_NAME) #oGuiElement.setFunction('showHosterMenu') oGuiElement.setFunction('play') oGuiElement.setTitle(oHoster.getDisplayName()) # oGuiElement.setThumbnail(sThumbnail) # if (oInputParameterHandler.exist('sMeta')): # sMeta = oInputParameterHandler.getValue('sMeta') # oGuiElement.setMeta(int(sMeta)) oGuiElement.setFileName(oHoster.getFileName()) oGuiElement.getInfoLabel() #oGuiElement.setThumbnail(xbmc.getInfoLabel('ListItem.Art(thumb)')) #oGuiElement.setMeta(1) oGuiElement.setIcon('host.png') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sMediaUrl', sMediaUrl) oOutputParameterHandler.addParameter('sThumbnail', sThumbnail) oOutputParameterHandler.addParameter('sHosterIdentifier', oHoster.getPluginIdentifier()) oOutputParameterHandler.addParameter('bGetRedirectUrl', bGetRedirectUrl) oOutputParameterHandler.addParameter('sFileName', oHoster.getFileName()) oOutputParameterHandler.addParameter('sTitle', oHoster.getDisplayName()) oOutputParameterHandler.addParameter('sId', 'cHosterGui') oOutputParameterHandler.addParameter('siteUrl', sMediaUrl) oOutputParameterHandler.addParameter('sFav', 'play') oOutputParameterHandler.addParameter('sCat', '4') #context read and noread oContext = cContextElement() oContext.setFile('cGui') oContext.setSiteName('cGui') oContext.setFunction('setWatched') oContext.setTitle('[COLOR azure]Marquer vu/Non vu[/COLOR]') #oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) #oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) #context playlit menu oContext = cContextElement() oContext.setFile('cHosterGui') oContext.setSiteName(self.SITE_NAME) oContext.setFunction('addToPlaylist') oContext.setTitle(cConfig().getLocalizedString(30201)) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) #context download menu oContext = cContextElement() oContext.setFile('cHosterGui') oContext.setSiteName(self.SITE_NAME) oContext.setFunction('download') oContext.setTitle(cConfig().getLocalizedString(30202)) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) #context FAV menu oContext = cContextElement() oContext.setFile('cFav') oContext.setSiteName('cFav') oContext.setFunction('setFavorite') oContext.setTitle('[COLOR teal]' + cConfig().getLocalizedString(30203) + '[/COLOR]') #oOutputParameterHandler = cOutputParameterHandler() #oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) #oOutputParameterHandler.addParameter('siteUrl', sMediaUrl) #oOutputParameterHandler.addParameter('sFav', 'play') #oOutputParameterHandler.addParameter('sId', 'cHosterGui') oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) oGui.addFolder(oGuiElement, oOutputParameterHandler, False)
def showLists(): oInputParameterHandler = cInputParameterHandler() iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') sUrl = oInputParameterHandler.getValue('siteUrl') result = grab.getUrl('list/'+sUrl, iPage, '') oGui = cGui() total = len(result) if (total > 0): for i in result['items']: sId, sType, sThumbnail, sFanart, sVote, sDesc = i['id'], i['media_type'], i['poster_path'], i['backdrop_path'], i['vote_average'], i['overview'] if sThumbnail: sThumbnail = POSTER_URL + sThumbnail else: sThumbnail = '' if sFanart: sFanart = FANART_URL + sFanart else : sFanart = '' sTitle = "None" if 'name' in i: sTitle = i['name'].encode("utf-8") if 'title' in i: sTitle = i['title'].encode("utf-8") sDisplayTitle = "%s (%s)" % (sTitle, sVote) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'none') oOutputParameterHandler.addParameter('sMovieTitle', str(sTitle)) oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail)) oOutputParameterHandler.addParameter('sId', str(sId)) oOutputParameterHandler.addParameter('sFanart', str(sFanart)) oOutputParameterHandler.addParameter('sTmdbId', i['id']) oOutputParameterHandler.addParameter('searchtext', sTitle) #oGui.addTVDB(SITE_IDENTIFIER, 'showSeriesSaison', sTitle, 'series.png', sThumbnail, sFanart, oOutputParameterHandler) cGui.CONTENT = "movies" oGuiElement = cGuiElement() oGuiElement.setTmdbId(i['id']) oGuiElement.setSiteName('cHome') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sDisplayTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('series.png') if sType == 'movie': oGuiElement.setMeta(1) elif sType == 'tv': oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGuiElement.setDescription(sDesc) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setEndOfDirectory(view)
def showFilmActor(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') result = grab.getUrl(sUrl, iPage) total = len(result) if (total > 0): for i in result['cast']: try: sTitle = unicodedata.normalize('NFKD', i['title']).encode('ascii','ignore') except: sTitle = "Aucune information" sId = i['id'] try: sThumbnail = POSTER_URL + i['poster_path'] except: sThumbnail = '' #sTitle = sTitle.encode("utf-8") oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'none') oOutputParameterHandler.addParameter('sMovieTitle', str(sTitle)) oOutputParameterHandler.addParameter('sTmdbId', sId) oOutputParameterHandler.addParameter('sThumbnail', str(sThumbnail)) oOutputParameterHandler.addParameter('type', 'film') oOutputParameterHandler.addParameter('searchtext', showTitle(sTitle, str('none'))) #oGui.addMovieDB('globalSearch', 'showHosters', sTitle, '', sThumbnail, '', oOutputParameterHandler) oGuiElement = cGuiElement() oGuiElement.setTmdbId(sId) oGuiElement.setSiteName('cHome') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('actors.png') oGuiElement.setMeta(1) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) #pas de paramettre de page # if (iPage > 0): # iNextPage = int(iPage) + 1 # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', sUrl) # oOutputParameterHandler.addParameter('page', iNextPage) # oGui.addDir(SITE_IDENTIFIER, 'showFilmActor', '[COLOR teal]Page '+str(iNextPage)+' >>>[/COLOR]', 'next.png', oOutputParameterHandler) oGui.setEndOfDirectory()
oParams) oGui.setEndOfDirectory() ######## Allgemeines def __createMenuEntry(oGui, sFunction, sLabel, dOutputParameter): oParams = ParameterHandler() # Create all paramters out of lOuputParameter try: for param, value in dOutputParameter.items(): oParams.setParam(param, value) except Exception, e: logger.error("Can't add parameter to menu entry with label: %s: %s" % (sLabel, e)) # Create the gui element oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGui.addFolder(oGuiElement, oParams) ######## Seitenspezifisch 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'),
def showWeb(): #Code qui s'occupe de liens TV du Web oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') playlist = parseM3U(sUrl) if (oInputParameterHandler.exist('AZ')): sAZ = oInputParameterHandler.getValue('AZ') string = filter(lambda t: t.title.strip().capitalize().startswith(sAZ), playlist) playlist = sorted(string, key=lambda t: t.title.strip().capitalize()) else: playlist = sorted(playlist, key=lambda t: t.title.strip().capitalize()) if not playlist: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addText( SITE_IDENTIFIER, "[COLOR red] Problème de lecture avec la playlist[/COLOR] ") else: total = len(playlist) progress_ = progress().VScreate(SITE_NAME) for track in playlist: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sThumb = track.icon if not sThumb: sThumb = 'tv.png' #les + ne peuvent pas passer url2 = track.path.replace('+', 'P_L_U_S') if not '[' in url2 and not ']' in url2 and not '.m3u8' in url2: url2 = 'plugin://plugin.video.f4mTester/?url=' + urllib.quote_plus( url2 ) + '&streamtype=TSDOWNLOADER&name=' + urllib.quote( track.title) thumb = '/'.join([sRootArt, sThumb]) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', url2) oOutputParameterHandler.addParameter('sMovieTitle', track.title) oOutputParameterHandler.addParameter('sThumbnail', thumb) #oGui.addDirectTV(SITE_IDENTIFIER, 'play__', track.title, 'tv.png' , sRootArt + '/tv/' + sThumb, oOutputParameterHandler) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('play__') oGuiElement.setTitle(track.title) oGuiElement.setFileName(track.title) oGuiElement.setIcon('tv.png') oGuiElement.setMeta(0) oGuiElement.setThumbnail(thumb) oGuiElement.setDirectTvFanart() oGuiElement.setCat(6) oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'direct_epg', 'Guide tv Direct') oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'soir_epg', 'Guide tv Soir') oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, SITE_IDENTIFIER, 'enregistrement', 'Enregistrement') oGui.createContexMenuFav(oGuiElement, oOutputParameterHandler) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) oGui.setEndOfDirectory()