def showHosters():
    params = ParameterHandler()
    imdbID = params.getValue('itemID')
    lang = params.getValue('lang')
    if not imdbID or not lang: return

    hosters = []
    for sLang in re.compile('(\w+)-').findall(lang):
        oResponse = _getJSonResponse(URL_LINKS, {'ID':imdbID,'lang':sLang} )
        if 'links' not in oResponse or len(oResponse['links']) == 0:
            return

        for aEntry in oResponse['links']:
            hoster = dict()
            if oResponse['links'][aEntry][0].upper() in QUALITY_ENUM:
                hoster['quality'] = QUALITY_ENUM[oResponse['links'][aEntry][0]]
            hoster['link'] = URL_OUT % oResponse['links'][aEntry][1]
            hoster['name'] = aEntry
            hoster['displayedName'] = '%s (%s) - Quality: %s' % (aEntry, sLang, oResponse['links'][aEntry][0])
            hosters.append(hoster)

    if hosters:
        hosters = sorted(hosters, key=lambda k: k['name']) #sort by hostername
        hosters.append('play')
    return hosters
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, 'Blowjob', '661&prefixid=Blowjob')
    __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 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()
Example #4
0
def __getAllSeasons(sUrl):
    oGui = cGui()
    oRequest = cRequestHandler(sUrl)
    sHtmlContent = oRequest.request()

    sPattern = '<SELECT name="season".*?>(.*?)</SELECT>'
    oParser = cParser()
    
    aResult = oParser.parse(sHtmlContent, sPattern)
    if (aResult[0] == True):
        sPattern = '<OPTION value="(\d+)".*?>([^<]+)</OPTION>'
        aResult = oParser.parse(sHtmlContent,sPattern)
        if (aResult[0] == True):
            for aEntry in aResult[1]:
                oGuiElement = cGuiElement()
                oGuiElement.setSiteName(SITE_IDENTIFIER)
                oGuiElement.setFunction('showAllEpisodes')

                sTitle = aEntry[1].strip()
                oGuiElement.setTitle(sTitle)

                oOutputParameterHandler = ParameterHandler()
                oOutputParameterHandler.setParam('sUrl', sUrl)
                oOutputParameterHandler.setParam('season', aEntry[0])
                
                oGui.addFolder(oGuiElement, oOutputParameterHandler)
    oGui.setView('seasons')
    oGui.setEndOfDirectory()
def showGenre():
    oGui = cGui()

    oInputParameterHandler = ParameterHandler()
    if (oInputParameterHandler.exist(PARAM_URL_KEY)):
        sUrl = oInputParameterHandler.getValue(PARAM_URL_KEY)

        oRequest = cRequestHandler(sUrl)
        sHtmlContent = oRequest.request()

        sPattern = '<li><a href="([^"]+)" title="Alle[^"]+">([^<]+)<span>'

        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for aEntry in aResult[1]:
                sUrl = aEntry[0]
                sUrl = URL_MAIN + sUrl
                sTitle = aEntry[1].strip()

                oGuiElement = cGuiElement()
                oGuiElement.setSiteName(SITE_IDENTIFIER)
                oGuiElement.setFunction('showMovies')
                oGuiElement.setTitle(sTitle)

                oOutputParameterHandler = ParameterHandler()
                oOutputParameterHandler.setParam(PARAM_URL_KEY, sUrl)
                oOutputParameterHandler.setParam(PARAM_ROOTURL_KEY, sUrl)
                oOutputParameterHandler.setParam(PARAM_PAGE_KEY,1)
                oGui.addFolder(oGuiElement, oOutputParameterHandler)

    oGui.setEndOfDirectory()
Example #6
0
def showFrontPage():
    oParams = ParameterHandler()
    sPattern = '<div class="box-container">.*?<a href="(.*?)".*?Staffel (.*?) Episode (.*?)".*?src="(http://seriesever.net/uploads/posters/thumb/.*?)".*?alt="(.*?)"'

    # request
    sHtmlContent = __getHtmlContent(URL_MAIN)
    # parse content
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)

    oGui = cGui()
    if (aResult[0] == True):
        for link, season, episode, img, title in aResult[1]:
            guiElement = cGuiElement('%s: Season %s - Episode %s' % (title, season, episode), SITE_IDENTIFIER, 'showHosters')
            guiElement.setMediaType('episode')
            guiElement.setSeason(season)

            # Special fix for non-int episode numbers (like Attack on Titan 13.5)
            # Can't even check this on thetvdb.com, because AOT 13.5 for example is Season 0 Episode 1
            # May I can use "<airsbefore_episode>" and "<airsbefore_season>" for metadata
            if representsInt(episode):
                guiElement.setEpisode(episode)

            guiElement.setTVShowTitle(title)
            guiElement.setThumbnail(img)

            oParams.setParam('sUrl', link)
            oGui.addFolder(guiElement, oParams, bIsFolder=False)

    oGui.setView('episodes')
    oGui.setEndOfDirectory()
Example #7
0
def showEpisodes():
    logger.info('load showEpisodes')
    oParams = ParameterHandler()
    sTitle = oParams.getValue('Title')
    sSeason = oParams.getValue('Season')

    sPattern = 'class="list-group-item".*?<span itemprop="name">Staffel ' + sSeason + ' Episode(?:[\s]*)(.*?)</span>.*?<a class="episode-name" href="(.*?)" title="(.*?)"'

    # request
    sHtmlContent = __getHtmlContent()
    # parse content
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)

    oGui = cGui()
    if (aResult[0] == True):
        for eNr, link, title in aResult[1]:
            guiElement = cGuiElement('Episode %s - %s' % (eNr, title), SITE_IDENTIFIER, 'showHosters')
            guiElement.setMediaType('episode')
            guiElement.setSeason(sSeason)

            # Special fix for non-int episode numbers (like Attack on Titan 13.5)
            # Can't even check this on thetvdb.com, because AOT 13.5 for example is Season 0 Episode 1
            # May I can use "<airsbefore_episode>" and "<airsbefore_season>" for metadata
            if representsInt(eNr):
                guiElement.setEpisode(eNr)

            guiElement.setTVShowTitle(sTitle)

            oParams.setParam('sUrl', link)
            oGui.addFolder(guiElement, oParams, bIsFolder=False)

    oGui.setView('episodes')
    oGui.setEndOfDirectory()
def showGenres():
    oGui = cGui()
    params = ParameterHandler()
    for key in sorted(URL_GENRES_LIST):
        params.setParam("sUrl", (URL_MAIN + URL_GENRES_LIST[key]))
        oGui.addFolder(cGuiElement(key, SITE_IDENTIFIER, "showEntries"), params)
    oGui.setEndOfDirectory()
def showHosters():
    params= ParameterHandler()
    oRequestHandler = cRequestHandler(params.getValue('entryUrl'))
    sHtmlContent = oRequestHandler.request()
    pattern = '<div class="inner" style="display:none;">'
    pattern += '.*?<a target="_blank" href="([^"]+)">'
    aResult = cParser().parse(sHtmlContent, pattern)
    if not aResult[0]:
        return
    hosters = []
    idx = 0
    previousName = ''
    for sUrl in aResult[1]:
        hoster = dict()
        hoster['link'] = sUrl
        hname = 'Unknown Hoster'
        try:
            hname = getHosterName(hoster['link'])
        except:
            pass
        if hname == 'linkcrypt.ws':
            resolveLinkcrypt(sUrl, hosters)
            continue
        if previousName != hname:
            idx = 1
        previousName = hname
        hname = "Part %d - %s" % (idx, hname)
        idx += 1

        hoster['name'] = previousName
        hoster['displayedName'] = hname
        hosters.append(hoster)
    if hosters:
        hosters.append('getHosterUrl')
    return hosters
Example #10
0
def getHosters():
    oParams = ParameterHandler()
    sChannelUrl = oParams.getValue('channelUrl')
    sChannelName = oParams.getValue('channelName')
    logger.info('get stream url for URL: ' + sChannelUrl)

    oRequestHandler = cRequestHandler(sChannelUrl)
    oRequestHandler.addHeaderEntry('Referer', URL_MAIN)
    sHtmlContent = oRequestHandler.request();

    hosters = []

    sPattern = "'file': '(.*?)',"
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    if aResult[0]:
        sUrl = str(aResult[1])[2:-2]
        logger.info('load channel ' + sChannelName + ' with url ' + sUrl)

        hoster = {}
        hoster['link'] = sUrl
        hoster['name'] = 'streamcloud'  # dummy
        hosters.append(hoster)
    hosters.append('getHosterUrl')
    return hosters
def showSearchEntries(entryUrl=False, sGui=False):
    oGui = sGui if sGui else cGui()
    params = ParameterHandler()
    if not entryUrl:
        entryUrl = params.getValue("sUrl")
    sHtmlContent = cRequestHandler(entryUrl).request()
    pattern = (
        'class="short">.*?href="([^"]+)"[^>]class="title">([^<(]+)[^>]([^")]+).*?<img[^>]src="([^"]+)".*?>([^<]+)</p>'
    )
    aResult = cParser().parse(sHtmlContent, pattern)
    if not aResult[0]:
        if not sGui:
            oGui.showInfo("xStream", "Es wurde kein Eintrag gefunden")
        return
    total = len(aResult[1])
    util = cUtil()
    for sEntryUrl, sName, sYear, sThumbnail, sDescription in aResult[1]:
        oGuiElement = cGuiElement(util.unescape(sName.decode("utf-8")).encode("utf-8"), SITE_IDENTIFIER, "showHosters")
        oGuiElement.setThumbnail(URL_MAIN + sThumbnail)
        oGuiElement.setDescription(util.unescape(sDescription.decode("utf-8")).encode("utf-8"))
        oGuiElement.setYear(sYear)
        oGuiElement.setMediaType("movie")
        params.setParam("entryUrl", sEntryUrl)
        oGui.addFolder(oGuiElement, params, False, total)
    return
Example #12
0
def _cinema(oGui):
    sPattern = '<div class="Opt leftOpt Headlne"><a title="(.*?)" href="(.*?)">.*?src="(.*?)".*?class="Descriptor">(.*?)</div.*?/lng/([0-9]+).png".*?IMDb:</b> (.*?) /'
    oParams = ParameterHandler()
    sSecurityValue = oParams.getValue('securityCookie')
    sHtmlContent = __getHtmlContent(URL_CINEMA_PAGE, sSecurityValue)
    # parse content
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    # iterate result and create GuiElements
    if (aResult[0] == True):
        total = len(aResult[1])
        for aEntry in aResult[1]:
            sMovieTitle = aEntry[0]
            lang = aEntry[4]
            rating = aEntry[5]
            oGuiElement = cGuiElement()
            oGuiElement.setSiteName(SITE_IDENTIFIER)
            oGuiElement.setFunction('parseMovieEntrySite')
            oGuiElement.setTitle(__createTitleWithLanguage(lang, sMovieTitle))
            oGuiElement.setDescription(aEntry[3])
            oGuiElement.setMediaType('movie')
            oGuiElement.setThumbnail(aEntry[2])
            oGuiElement.addItemValue('rating',rating)
            #if META:
            #    oMetaget = metahandlers.MetaData()
            #    meta = oMetaget.get_meta('movie', sMovieTitle)
            #    oGuiElement.setItemValues(meta)
            #    oGuiElement.setThumbnail(meta['cover_url'])
            #    oGuiElement.setFanart(meta['backdrop_url'])
            #    oParams.setParam('imdbID', meta['imdb_id'])

            oParams.setParam('sUrl', URL_MAIN + str(aEntry[1]))
            oGui.addFolder(oGuiElement, oParams, bIsFolder = False, iTotal = total)
Example #13
0
    def _getInfoAndResolve(self, siteResult):
        import urlresolver
        oGui = cGui()
        params = ParameterHandler()
        # get data
        data = {}
        mediaUrl = params.getValue('sMediaUrl')
        fileName = params.getValue('MovieTitle')
        if not fileName:
            fileName = params.getValue('Title')
        if not fileName: #only temporary
            fileName = params.getValue('sMovieTitle')
        if not fileName:
            fileName = params.getValue('title')

        data['title'] = fileName
        data['season'] = params.getValue('season')
        data['episode'] = params.getValue('episode')
        data['showTitle'] = params.getValue('TVShowTitle')
        data['thumb'] = params.getValue('thumb')
        # resolve
        if siteResult:
            mediaUrl = siteResult['streamUrl']
            logger.info('resolve: ' + mediaUrl)
            if siteResult['resolved']:
                link = mediaUrl
            else:
                link = urlresolver.resolve(mediaUrl)
        elif mediaUrl:
            logger.info('resolve: ' + mediaUrl)
            link = urlresolver.resolve(mediaUrl)
        else:
            oGui.showError('xStream', 'kein Hosterlink übergeben', 5)
            return False
        #resolver response
        if hasattr(link, 'msg'):
            msg = link.msg
        else: msg = False
        if link != False and not msg:
            data['link'] = link
            return data
        # error during resolving
        if not msg:
            msg = 'Stream nicht mehr verfügbar oder Link fehlerhaft'
            oGui.showError('xStream',str(msg),7)
        if hasattr(link, 'code'):
            logger.info(str(msg) +' UnresolveableCode: '+ str(link.code))
        else:
            logger.info(str(msg) +' UnresolveableCode: - ')
        '''
            UnresolveableCode
            0: Unknown Error
            1: The url was resolved, but the file has been permanantly
                removed
            2: The file is temporarily unavailable for example due to
                planned site maintenance
            3. There was an error contacting the site for example a
                connection attempt timed out
        '''
        return False
Example #14
0
def showHosters():
    params = ParameterHandler()
    sHtmlContent = cRequestHandler(params.getValue('entryUrl')).request()
    aResult = cParser().parse(sHtmlContent, "var[ ]subcats[ ]=[ ](.*?);")
    if not aResult[0]: return []

    hosters = []
    data = json.loads(aResult[1][0])
    sJsonID = params.getValue('sJsonID')
    if not sJsonID:
        sJsonID = data.keys()[0]
    partCount = 1 # fallback for series (because they get no MultiParts)
    if '1' in data[sJsonID]:
        partCount = int(data[sJsonID]['1'])
    for jHoster in data[sJsonID]['links']:
        for jHosterEntry in data[sJsonID]['links'][jHoster]:
            if jHosterEntry[5] != 'stream': continue
            hoster = {}
            if partCount > 1:
                hoster['displayedName'] = jHoster + ' - Part ' + jHosterEntry[0]
            hoster['link'] = jHosterEntry[3]
            hoster['name'] = jHoster
            hosters.append(hoster)

    if len(hosters) > 0:
        hosters.append('getHosterUrl')
    return hosters
def _search(oGui, sSearchString):
    searchUrl = URL_MAIN + 'livesearch.php?q='
    
    oRequest = cRequestHandler(searchUrl + sSearchString)
    content = oRequest.request()
    searchPattern = "<table.*?<a href='([^']+)'.*?<img src='([^']+)'.*?>([^<>']+)</a>"
    oParser = cParser()
    aResult = oParser.parse(content, searchPattern)
    if not aResult[0]:
        return
    ###### parse entries
    params = ParameterHandler()
    function = 'getHosters'
    iTotal = len(aResult[1])
    for link, img, title in aResult[1]:
        sLabel = title.split('(')
        sTitle = sLabel[0].strip()
        sNextUrl = link
        params.setParam('siteUrl',sNextUrl)
        oGuiElement = cGuiElement(sTitle, SITE_IDENTIFIER, function)
        oGuiElement.setThumbnail(img)
        #oGuiElement.setMediaType('movie')
        if len(sLabel)>1:
            year = sLabel[-1].replace(')','')
            oGuiElement.setYear(year)
        if 'site=Movies' in link:
            oGuiElement.setMediaType('movie')
            oGui.addFolder(oGuiElement, params, bIsFolder = False, iTotal = iTotal)
        else:
            continue
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):
        hosters = []
        sHtmlContent = aResult[1][0]
        sPattern = 'href="([^"]+)">.*?class="icon ([^"]+)"></span> ([^<]+?)</a>'
        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for aEntry in aResult[1]:
                hoster = dict()
                hoster['link'] = URL_MAIN + '/' + str(aEntry[0])
                hoster['name'] = str(aEntry[2]).split(' - Teil')[0]
                hoster['displayedName'] = str(aEntry[2])
                hosters.append(hoster)
    hosters.append('getHosterUrl')
    return hosters
Example #17
0
def showSeries(sUrl=False):
    logger.info('load showSeries')
    oParams = ParameterHandler()

    if not sUrl:
        sUrl = oParams.getValue('sUrl')

    sPagePattern = '<a href="' + sUrl + '(\d+).html">'

    # request
    sHtmlContent = __getHtmlContent(sUrl)
    # parse content
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPagePattern)

    pages = 1
    if aResult[0]:
        if representsInt(aResult[1][-1]):
            pages = aResult[1][-1]

    oGui = cGui()

    # because sometimes 2 pages have the same content
    dupeCheck = []
    for x in range(1, int(pages) + 1):
        dupeCheck = showSeriesPage(oGui, sUrl, x, dupeCheck)

    oGui.setView('tvshows')
    oGui.setEndOfDirectory()
Example #18
0
def showHosters():
    oInputParameterHandler = ParameterHandler()
    sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
    sUrl = oInputParameterHandler.getValue(PARAM_URL_KEY)
    sHtmlContent = cRequestHandler(sUrl).request()
    
    sPattern = 'data-det="([^"]+)"'
    aResult = cParser().parse(sHtmlContent, sPattern)
    results = []

    if not aResult[0]: return results
    # can't handle without changes to requestHandler
    import mechanize, json
    request = mechanize.Request("http://kkiste.to/xhr/link", aResult[1][0])
    request.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
    request.add_header("X-Requested-With","XMLHttpRequest")
    request.add_header('Referer', sUrl)
    request.add_header('Accept', '*/*')
    request.add_header('Host', SITE_NAME.lower())
    request.add_header('Content-Length',len(aResult[1][0]))
    request.add_header('Content-Type','text/plain')
    resp = mechanize.urlopen(request)
    sHtmlContent = resp.read()
    try: items = json.loads(sHtmlContent)
    except: return results
    # multipart stream
    for i, item in enumerate(items) :
        result = {}
        result['streamUrl'] = 'http://www.ecostream.tv/stream/'+item
        result['resolved'] = False
        result['title'] = sMovieTitle + ' part ' +str(i)
        results.append(result)
    return results
Example #19
0
def showSeasons():
    logger.info('load showSeasons')
    oParams = ParameterHandler()
    sTitle = oParams.getValue('Title')
    sPattern = '<a href="#season-(.*?)" data-parent=".*?>(.*?)</a>'

    # request
    sHtmlContent = __getHtmlContent()
    # parse content
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)

    oGui = cGui()
    if aResult[0]:
        for sId, seasonNum in aResult[1]:
            guiElement = cGuiElement('%s - Staffel %s' % (sTitle, seasonNum), SITE_IDENTIFIER, 'showEpisodes')
            guiElement.setMediaType('season')
            guiElement.setSeason(seasonNum)
            guiElement.setTVShowTitle(sTitle)

            oParams.setParam('Season', seasonNum)
            oGui.addFolder(guiElement, oParams)

    oGui.setView('seasons')
    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 showHosters():
    # ParameterHandler erzeugen
    params = ParameterHandler()
    
    # URL Anpassen um die Stream und nicht die Infos zu bekommen
    entryUrl = params.getValue('entryUrl').replace("-info","-stream")

    # Seite abrufen
    sHtmlContent = cRequestHandler(entryUrl).request()

    # Prüfen ob Episoden gefunden werden
    pattern = '<a[^>]*episode="([^"]*)"[^>]*href="([^"]*)"[^>]*>'
    aResult = cParser().parse(sHtmlContent, pattern)

    # Prüfen ob Einträge vorliegen
    if not aResult[0]:
        return

    # Ermitteln ob es sich um eine Serie handelt
    isTvshowEntry = params.getValue('isTvshow')

    # Falls Episoden gefunden worden => Episodenauswahl vorschalten
    if isTvshowEntry == 'True':
        showEpisodes(aResult[1], params)
    else:
        return getHosters(entryUrl)
Example #22
0
def __writeLog(sLog, cLogLevel):
    params = ParameterHandler()
    if params.exist('site'):
        site = params.getValue('site')
        print "\t[PLUGIN] xStream->" + site + ": " + str(sLog)
    else:
        print "\t[PLUGIN] xStream: " + str(sLog)
Example #23
0
def showHostersSeries():
    oInputParameterHandler = ParameterHandler()
    if (oInputParameterHandler.exist('sUrl') and oInputParameterHandler.exist('sMovieTitle')):
        sUrl = oInputParameterHandler.getValue('sUrl')
        sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
        
        sHtmlContent = cRequestHandler(sUrl).request()        
        sPattern = '<tr id="tablemoviesindex2".*?<a href="([^"]+)".*? width="16">([^<]+)<'
        aResult = cParser().parse(sHtmlContent.replace('\\',''), sPattern)       
        if (aResult[0] == True):
            hosters = []
            previousName = ''
            iMatches = 2
            for aEntry in aResult[1]:
                sHoster = aEntry[1].strip()
                hoster = {}
                hoster['name'] = sHoster
                hoster['link'] = URL_MAIN + aEntry[0] 
                if hoster['name'] == previousName:
                    hoster['displayedName'] = hoster['name'] + ' ('+str(iMatches)+')'
                    iMatches += 1
                else:
                    previousName = hoster['name']
                    iMatches = 2            
                hosters.append(hoster)
            hosters.append('showHoster')
            return hosters
def showSeries():    
    oGui = cGui()  
    oParams = ParameterHandler()  
    
    sUrl = URL_SERIES
    oRequestHandler = cRequestHandler(sUrl)
    sHtmlContent = oRequestHandler.request();
    sChar = oParams.getValue('char')
    if sChar: sChar = sChar.lower()

    series = json.loads(sHtmlContent)
    total = len(series)
    for serie in series:
        sTitle = serie["series"].encode('utf-8') 
        if sChar:
            if sChar == '#':
                if sTitle[0].isalpha():continue
            elif sTitle[0].lower() != sChar: continue
     
        guiElement = cGuiElement(sTitle, SITE_IDENTIFIER, 'showSeasons')
        guiElement.setMediaType('tvshow')
        guiElement.setThumbnail(URL_COVER % serie["id"])        
        oParams.addParams({'siteUrl' : URL_SERIES + '/' + str(serie["id"]), 'Title' : sTitle})
        oGui.addFolder(guiElement, oParams, iTotal = total)

    oGui.setView('tvshows')
    oGui.setEndOfDirectory()
def __getHtmlContent(sUrl = None, sSecurityValue=None):
    params = ParameterHandler()

    # Test if a url is available and set it
    if sUrl is None and not params.exist('siteUrl'):
        logger.info("There is no url we can request.")
        return False
    else:
        if sUrl is None:
            sUrl = params.getValue('siteUrl')

    # Test if a security value is available
    if sSecurityValue is None:
        if params.exist('securityCookie'):
            sSecurityValue = params.getValue('securityCookie')
        else :
            sSecurityValue = ''

    # Make the request
    oRequest = cRequestHandler(sUrl)
    #oRequest.addHeaderEntry('Cookie', sSecurityValue)
    #oRequest.addHeaderEntry('Accept', '*/*')
    #oRequest.addHeaderEntry('Host', 'gstream.to')

    return oRequest.request()
Example #26
0
    def download(self, siteResult = False):
        from resources.lib.download import cDownload
        import urlresolver
        #oGui = cGui()
        params = ParameterHandler()

        sMediaUrl = params.getValue('sMediaUrl')
        sFileName = params.getValue('sFileName')
        sFileName = params.getValue('sMovieTitle')
        if siteResult:
            sMediaUrl = siteResult['streamUrl']
            if siteResult['resolved']:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)
        logger.info('call download: ' + sMediaUrl)
        logger.info('file link: ' + str(sLink))
        if self.dialog:
            self.dialog.close()
        if (sLink != False):
            oDownload = cDownload()
            oDownload.download(sLink, 'Stream')
        else:
            #cGui().showError('Download', 'File deleted or Link could not be resolved', 5);
            return False
        return True
def __getHtmlContent(sUrl = None, sSecurityValue = None):
    oParams = ParameterHandler()
    # Test if a url is available and set it
    if sUrl is None and not oParams.exist('sUrl'):
        logger.error("There is no url we can request.")
        return False
    else:
        if sUrl is None:
            sUrl = oParams.getValue('sUrl')
    # Test if a security value is available
    if sSecurityValue is None:
        if oParams.exist("securityCookie"):
            sSecurityValue = oParams.getValue("securityCookie")
    if not sSecurityValue:
        sSecurityValue = ''
    # preferred language
    sPrefLang = __getPreferredLanguage()
    # Make the request
    oRequest = cRequestHandler(sUrl)
    oRequest.addHeaderEntry('Cookie', sPrefLang+sSecurityValue+'ListDisplayYears=Always;')
    oRequest.addHeaderEntry('Referer', URL_MAIN)
    oRequest.addHeaderEntry('Accept', '*/*')
    oRequest.addHeaderEntry('Host', domain)

    return oRequest.request()
def _parseMovieList(url): 
    oGui = cGui()  
    params = ParameterHandler()    
    oRequestHandler = cRequestHandler(url)
    sHtmlContent = oRequestHandler.request()
    # parse movie entries
    pattern = 'class="tabel-topasd".*?<a href="([^"]+)"><img src="([^"]+)" title="([^"]+)".*?<span.*?>([^<>]+)</span>.*?title="([^"]+)"/>'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, pattern)
    if not aResult[0]:
        return
    total = len(aResult[1]) # Anzahl der Treffer
    for link, img, title, plot, qual in aResult[1]:
        titleParts = title.split('(') # Titel von Jahr trennen
        movieTitle = titleParts[0].strip().decode('iso-8859-1').encode('utf-8') # encoding anpassen wegen Umlauten
           
        guiElement = cGuiElement(movieTitle, SITE_IDENTIFIER, 'getHosters')
        guiElement.setThumbnail(img) #Cover als Thumbnail setzen
        guiElement.setDescription(plot.decode('iso-8859-1')) # Filmbeschreibung setzen, decode wegen Umlauten
        if len(titleParts)>1:
            tag = titleParts[-1].replace(')','')
            if tag.isdigit() and len(tag)==4:
                guiElement.setYear(tag)
        guiElement.setMediaType('movie')
        if '720p' in qual: # erst mal unwichtig
            guiElement._sQuality = 720
        elif '1080p' in qual:
            guiElement._sQuality = 1080
            
        params.setParam('siteUrl',link)
        oGui.addFolder(guiElement, params, bIsFolder = False, iTotal = total)
    oGui.setView('movies') #diese Liste unterliegt den automatisch ViewSettings für Filmlisten 
    oGui.setEndOfDirectory()
def _cinema(oGui):
    sPattern = '<div class="Opt leftOpt Headlne"><a title="(.*?)" href="(.*?)">.*?src="(.*?)".*?class="Descriptor">(.*?)</div.*?/lng/([0-9]+).png".*?IMDb:</b> (.*?) /'
    oParams = ParameterHandler()
    sSecurityValue = oParams.getValue('securityCookie')
    sHtmlContent = __getHtmlContent(URL_CINEMA_PAGE, sSecurityValue)
    # parse content
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    # iterate result and create GuiElements
    if not aResult[0]: return
    total = len(aResult[1])
    for aEntry in aResult[1]:
        sMovieTitle = aEntry[0]
        lang = __createLanguage(aEntry[4])
        rating = aEntry[5]
        oGuiElement = cGuiElement()
        oGuiElement.setSiteName(SITE_IDENTIFIER)
        oGuiElement.setFunction('parseMovieEntrySite')
        oGuiElement.setLanguage(lang)
        oGuiElement.setTitle(sMovieTitle)
        oGuiElement.setDescription(aEntry[3])
        oGuiElement.setMediaType('movie')
        oGuiElement.setThumbnail(URL_MAIN + str(aEntry[2]))
        oGuiElement.addItemValue('rating', rating)
        oParams.setParam('sUrl', URL_MAIN + str(aEntry[1]))
        oGui.addFolder(oGuiElement, oParams, bIsFolder=False, iTotal=total)
Example #30
0
def __writeLog(sLog, cLogLevel):
    params = ParameterHandler()
    if params.exist('site'):
        site = params.getValue('site')
        print "\t[xStream] ->%s: %s" %(site,sLog)
    else:
        print "\t[xStream] %s" % sLog