def showHosters():
    oGui = cGui()

    oParams = ParameterHandler()
    sUrl = oParams.getValue('siteUrl')
    sTitle = oParams.getValue('sTitle')

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

    sPattern = '<h3>Hoster dieser Episode(.*?)</ul>'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    if aResult[0]:
        sHtmlContent = aResult[1][0]
        sPattern = '<li><a href="(.+?)"><span .+? class="icon (.+?)"></span>.+?</a>'
        aResult = oParser.parse(sHtmlContent, sPattern)
        if aResult[0]:
            for sUrl, sHoster in aResult[1]:
                sUrl = '%s/%s' % (URL_MAIN, sUrl)

                oGuiElement = cGuiElement(sHoster, SITE_IDENTIFIER,
                                          'getHosterUrlandPlay')
                oParams.setParam('siteUrl', sUrl)
                oParams.setParam('sTitle', sTitle)
                oGui.addFolder(oGuiElement, oParams, bIsFolder=True)
    oGui.setEndOfDirectory()
def showMovies():
    oParams = ParameterHandler()
    if oParams.getValue('siteUrl'):
        sUrl = URL_MAIN + oParams.getValue('siteUrl')     
    else:
        return  
    oGui = cGui()    
       
    oRequestHandler = cRequestHandler(sUrl)
    sHtmlContent = oRequestHandler.request()

    sPattern = '<div id="inner_content".*?<div class="clr">'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    if not aResult[0]:
        return
    # parse movie entries
    __parseMovieList(oGui, str(aResult[1][0]), oParams = oParams)
    # check for next site
    aResult = oParser.parse(sHtmlContent, 'href="([^"]+)" title="Weiter"')
    if aResult[0]:
        oParams = ParameterHandler()
        oParams.setParam('siteUrl',aResult[1][0])
        oGui.addNextPage(SITE_IDENTIFIER, 'showMovies', oParams)
    oGui.setView('movies')
    oGui.setEndOfDirectory()
def showHosters():
    oGui = cGui()

    oParams = ParameterHandler()
    sUrl = oParams.getValue('siteUrl')
    sTitle = oParams.getValue('sTitle')

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

    sPattern = '<h3>Hoster dieser Episode(.*?)</ul>'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    if aResult[0]:
        sHtmlContent = aResult[1][0]
        sPattern = '<li><a href="(.+?)"><span .+? class="icon (.+?)"></span>.+?</a>'
        aResult = oParser.parse(sHtmlContent, sPattern)
        if aResult[0]:
            for sUrl, sHoster in aResult[1]:
                sUrl = '%s/%s' % (URL_MAIN, sUrl)

                oGuiElement = cGuiElement(sHoster, SITE_IDENTIFIER, 'getHosterUrlandPlay')
                oParams.setParam('siteUrl', sUrl)
                oParams.setParam('sTitle', sTitle)
                oGui.addFolder(oGuiElement, oParams, bIsFolder=True)
    oGui.setEndOfDirectory()
Exemplo n.º 4
0
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', 'g-stream.in')

    return oRequest.request()
def showHosters():
    oGui = cGui()
	
    oParams= ParameterHandler()
    sTitle = oParams.getValue('Title')	
    sUrl = oParams.getValue('siteUrl')
    
    oRequestHandler = cRequestHandler(sUrl)
    sHtmlContent = oRequestHandler.request()
    if not META:
        __createInfo(oGui, sHtmlContent, sTitle)
    
    sPattern = '<h3>Hoster dieser Episode(.*?)</ul>'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    if (aResult[0] == True):
        sHtmlContent = aResult[1][0]

        sPattern = '<li><a href="([^"]+)">.*?class="icon ([^"]+)"></span> ([^<]+?)</a>'
        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for aEntry in aResult[1]:
                oHoster = cHosterHandler().getHoster2('//'+str(aEntry[1]).lower()+'/')              
                if (oHoster != False):
                    oGuiElement = cGuiElement(str(aEntry[2]),SITE_IDENTIFIER,'getHosterUrlandPlay')
                    oParams.setParam('siteUrl',URL_MAIN + '/' + str(aEntry[0]))
                    oParams.setParam('Hoster',oHoster)
                    oGui.addFolder(oGuiElement, oParams, bIsFolder = True)                    
    oGui.setEndOfDirectory()
def getHosterUrlandPlay():
    oGui = cGui()

    oParams = ParameterHandler()
    sTitle = oParams.getValue('Title')
    sUrl = oParams.getValue('siteUrl')
    sHoster = oParams.getValue('Hoster')

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

    sPattern = '<div id="video_actions">.*?<a href="([^"]+)" target="_blank">'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)

    if (aResult[0] == True):
        sStreamUrl = aResult[1][0]
        oHoster = cHosterHandler().getHoster(sHoster)
        cHosterGui().showHosterMenuDirect(oGui,
                                          oHoster,
                                          sStreamUrl,
                                          sFileName=sTitle)
        oGui.setEndOfDirectory()
        return
    oGui.setEndOfDirectory()
def showHosters():
    oGui = cGui()

    oParams = ParameterHandler()
    sTitle = oParams.getValue('Title')
    sUrl = oParams.getValue('siteUrl')

    oRequestHandler = cRequestHandler(sUrl)
    sHtmlContent = oRequestHandler.request()
    if not META:
        __createInfo(oGui, sHtmlContent, sTitle)

    sPattern = '<h3>Hoster dieser Episode(.*?)</ul>'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    if (aResult[0] == True):
        sHtmlContent = aResult[1][0]

        sPattern = '<li><a href="([^"]+)">.*?class="icon ([^"]+)"></span> ([^<]+?)</a>'
        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for aEntry in aResult[1]:
                oHoster = cHosterHandler().getHoster2('//' +
                                                      str(aEntry[1]).lower() +
                                                      '/')
                if (oHoster != False):
                    oGuiElement = cGuiElement(str(aEntry[2]), SITE_IDENTIFIER,
                                              'getHosterUrlandPlay')
                    oParams.setParam('siteUrl',
                                     URL_MAIN + '/' + str(aEntry[0]))
                    oParams.setParam('Hoster', oHoster)
                    oGui.addFolder(oGuiElement, oParams, bIsFolder=True)
    oGui.setEndOfDirectory()
def getHosters():
    oParams = ParameterHandler()
    sTitle = oParams.getValue('Title')
    sUrl = oParams.getValue('siteUrl')   
    
    logger.info("%s: hosters for movie '%s' " % (SITE_IDENTIFIER, sTitle)) 
    
    oRequestHandler = cRequestHandler(URL_MAIN+sUrl)
    sHtmlContent = oRequestHandler.request();

    sPattern = '<iframe src="([^"]+)"'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent.lower(), sPattern)
    hosters = []
    sFunction='getHosterUrl'
    if (aResult[0] == True):
        for aEntry in aResult[1]:
            hoster = {}
            hoster['link'] = aEntry
            # extract domain name
            temp = aEntry.split('//')
            temp = str(temp[-1]).split('/')
            temp = str(temp[0]).split('.')
            hoster['name'] = temp[-2]
            hosters.append(hoster)
    hosters.append(sFunction)
    return hosters
def showEpisodes():
    oGui = cGui()
    oParams = ParameterHandler()
    sShowTitle = oParams.getValue('Title')
    sUrl = oParams.getValue('siteUrl')
    sImdb = oParams.getValue('imdbID')    
    sSeason = oParams.getValue('Season')
    
    logger.info("%s: show episodes of '%s' season '%s' " % (SITE_NAME, sShowTitle, sSeason)) 
    
    oRequestHandler = cRequestHandler(sUrl)
    sHtmlContent = oRequestHandler.request();

    sPattern = '<table>(.*?)</table>'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    if (aResult[0] == True):
        sHtmlContent = aResult[1][0]
        sPattern = '<td>([^<]+)</td>\s*<td><a href="([^"]+)">(.*?)</a>.*?<td class="nowrap">(\s*<a|\s*</td).*?</tr>'
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
             for aEntry in aResult[1]:
                if aEntry[3].strip() == '</td':
                    continue
                sNumber = str(aEntry[0]).strip()
                oGuiElement = cGuiElement('Episode ' + sNumber, SITE_IDENTIFIER, 'showHosters')
                if META == True and not sImdb == '':
                    oMetaget = metahandlers.MetaData()
                    meta = oMetaget.get_episode_meta(sShowTitle, sImdb, sSeason, sNumber)
                    meta['TVShowTitle'] = sShowTitle
                    oGuiElement.setItemValues(meta)
                    oGuiElement.setThumbnail(meta['cover_url'])
                    oGuiElement.setFanart(meta['backdrop_url'])

                sPattern = '<strong>(.*?)</strong>'
                aResultTitle = oParser.parse(str(aEntry[2]), sPattern)
                if (aResultTitle[0]== True):
                    sTitleName = str(aResultTitle[1][0]).strip()
                else:
                    sPattern = '<span lang="en">(.*?)</span>'
                    aResultTitle = oParser.parse(str(aEntry[2]), sPattern)
                    if (aResultTitle[0]== True):
                        sTitleName = str(aResultTitle[1][0]).strip()
                    else:
                        sTitleName = ''
                sTitle = sNumber
                sTitleName = cUtil().unescape(sTitleName.decode('utf-8')).encode('utf-8')
                oParams.setParam('EpisodeTitle', sTitleName)
                sTitle = sTitle + ' - ' + sTitleName

                oGuiElement.setTitle(sTitle)
                oParams.setParam('siteUrl', URL_MAIN + '/' + str(aEntry[1]))
                oParams.setParam('EpisodeNr', sNumber)
                
                oParams.setParam('Title', sShowTitle+' - S'+sSeason+'E'+sTitle)
                oGui.addFolder(oGuiElement, oParams, iTotal = len(aResult[1]))
   
    oGui.setView('episodes')
    oGui.setEndOfDirectory()
Exemplo n.º 10
0
def parseMovieResultSite():
    oGui = cGui()
    params = ParameterHandler()
    if (params.exist('siteUrl')):
        siteUrl = params.getValue('siteUrl')
        normalySiteUrl = params.getValue('normalySiteUrl')
        iPage = params.getValue('iPage')
        __parseMovieResultSite(oGui, siteUrl, normalySiteUrl, iPage)
    oGui.setEndOfDirectory()
def showEpisodes():
    oGui = cGui()
    oParams = ParameterHandler()
    sShowTitle = oParams.getValue('Title')
    sUrl = oParams.getValue('siteUrl')
    sImdb = oParams.getValue('imdbID')
    sSeason = oParams.getValue('Season')

    logger.info("%s: show episodes of '%s', season '%s' " %
                (SITE_NAME, sShowTitle, sSeason))

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

    oParser = cParser()
    hParser = HTMLParser.HTMLParser()

    sPattern = '<tr>\s*<td>(.+?)</td>\s*<td><a href="(.+?)">\s*<strong>(.+?)</strong>.*?</tr>'
    aResult = oParser.parse(sHtmlContent, sPattern)
    try:
        if aResult[0]:
            for sNumber, sUrl, episodeTitle in aResult[1]:
                sUrl = '%s/%s' % (URL_MAIN, sUrl)
                episodeTitle = hParser.unescape(episodeTitle)

                oGuiElement = cGuiElement('Episode ' + sNumber,
                                          SITE_IDENTIFIER, 'showHosters')
                if META and sImdb:
                    oMetaget = metahandlers.MetaData()
                    meta = oMetaget.get_episode_meta(sShowTitle, sImdb,
                                                     sSeason, sNumber)
                    meta['TVShowTitle'] = sShowTitle
                    oGuiElement.setItemValues(meta)
                    oGuiElement.setThumbnail(meta['cover_url'])
                    oGuiElement.setFanart(meta['backdrop_url'])

                # how do we detect the language of the episode ?
                # fixed to 'de' for now as most of it seems to be german on burning-seri.es
                sTitle = 's%se%s - %s (%s)' % (
                    sSeason.zfill(2), sNumber.zfill(2), episodeTitle, 'de')
                oGuiElement.setTitle(sTitle)
                oParams.setParam('siteUrl', sUrl)
                oParams.setParam('EpisodeNr', sNumber)
                oParams.setParam('sTitle', sTitle)

                oGui.addFolder(oGuiElement, oParams, iTotal=len(aResult[1]))

        oGui.setView('episodes')
    except:
        import traceback
        traceback.print_exc()
    oGui.setEndOfDirectory()
def showEpisodes():
    oGui = cGui()
    oParams = ParameterHandler()
    sShowTitle = oParams.getValue('Title')
    sUrl = oParams.getValue('siteUrl')
    sImdb = oParams.getValue('imdbID')
    sSeason = oParams.getValue('Season')

    logger.info("%s: show episodes of '%s', season '%s' " % (SITE_NAME, sShowTitle, sSeason))

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

    oParser = cParser()
    hParser = HTMLParser.HTMLParser()

    sPattern = '<tr>\s*<td>(.+?)</td>\s*<td><a href="(.+?)">\s*<strong>(.+?)</strong>.*?</tr>'
    aResult = oParser.parse(sHtmlContent, sPattern)
    try:
        if aResult[0]:
            for sNumber, sUrl, episodeTitle in aResult[1]:
                sUrl = '%s/%s' % (URL_MAIN, sUrl)
                episodeTitle = hParser.unescape(episodeTitle)

                oGuiElement = cGuiElement('Episode ' + sNumber, SITE_IDENTIFIER, 'showHosters')
                if META and sImdb:
                    oMetaget = metahandlers.MetaData()
                    meta = oMetaget.get_episode_meta(sShowTitle, sImdb, sSeason, sNumber)
                    meta['TVShowTitle'] = sShowTitle
                    oGuiElement.setItemValues(meta)
                    oGuiElement.setThumbnail(meta['cover_url'])
                    oGuiElement.setFanart(meta['backdrop_url'])

                # how do we detect the language of the episode ?
                # fixed to 'de' for now as most of it seems to be german on burning-seri.es
                sTitle = 's%se%s - %s (%s)' % (sSeason.zfill(2), sNumber.zfill(2), episodeTitle, 'de')
                oGuiElement.setTitle(sTitle)
                oParams.setParam('siteUrl', sUrl)
                oParams.setParam('EpisodeNr', sNumber)
                oParams.setParam('sTitle', sTitle)

                oGui.addFolder(oGuiElement, oParams, iTotal=len(aResult[1]))

        oGui.setView('episodes')
    except:
        import traceback
        traceback.print_exc()
    oGui.setEndOfDirectory()
Exemplo n.º 13
0
def gotoPage():
    oGui = cGui()
    pageNum = oGui.showNumpad()
    if not pageNum:
        return
    params = ParameterHandler()
    siteUrl = params.getValue('normalySiteUrl')+pageNum
    __parseMovieResultSite(oGui, siteUrl, iPage = int(pageNum))
    oGui.setEndOfDirectory()
Exemplo n.º 14
0
def _search(oGui, sSearchText):
    params = ParameterHandler()
    sSearchType = params.getValue('searchType')
    sUrl = URL_SEARCH+'?do=process&childforums=1&do=process&exactname=1&forumchoice[]='+sSearchType+\
        '&query=' + str(sSearchText) + '&quicksearch=1&s=&securitytoken=guest&titleonly=1'
    oRequest = cRequestHandler(sUrl)
    oRequest.request()
    sUrl = oRequest.getRealUrl()
    __parseMovieResultSite(oGui, sUrl)
Exemplo n.º 15
0
def getHosterUrl(sUrl):
    results = []
    if 'g-stream.in/secure/' in sUrl :
        sHoster = sUrl.split('secure/')[-1].split('/')[0]
        params = ParameterHandler()        
        oRequest = cRequestHandler(sUrl, False)
        oRequest.addHeaderEntry('Cookie', params.getValue('securityCookie'))
        oRequest.addHeaderEntry('Referer', params.getValue('movieUrl'))
        try:
            oRequest.request()
            sUrl = oRequest.getRealUrl()
            sUrl = 'http://%s%s' % (sHoster, sUrl.split(sHoster)[-1])
        except:
            pass
    result = {}
    result['streamUrl'] = sUrl
    result['resolved'] = False
    results.append(result)
    return results
Exemplo n.º 16
0
def play():
    oInputParameterHandler = ParameterHandler()
    if (oInputParameterHandler.exist('sUrl') and oInputParameterHandler.exist('sTitle')):
        sUrl = oInputParameterHandler.getValue('sUrl')
        sTitle = oInputParameterHandler.getValue('sTitle')
        
        oRequest = cRequestHandler(sUrl)
        sHtmlContent = oRequest.request()

        sPattern = 'ake_playlist.php%3Fflv%3D(.*?)%26'

        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            sStreamUrl = URL_GET_STREAM + str(aResult[1][0])           
            result = {}
            result['streamUrl'] = sStreamUrl
            result['resolved'] = True
            return result
    return False
def getHosterUrlandPlay():
    oGui = cGui()

    oParams = ParameterHandler()
    sTitle = oParams.getValue('sTitle')
    sUrl = oParams.getValue('siteUrl')

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

    sPattern = '<div id="video_actions">.*?<a href="([^"]+)" target="_blank">'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)

    if aResult[0]:
        sStreamUrl = aResult[1][0]
        oHoster = cHosterHandler().getHoster(sStreamUrl)
        cHosterGui().showHosterMenuDirect(oGui, oHoster, sStreamUrl, sFileName=sTitle)
        oGui.setEndOfDirectory()
        return
    oGui.setEndOfDirectory()
Exemplo n.º 18
0
def getHosters():
    hosters = []
    params = ParameterHandler()
    if (params.exist('movieUrl') and params.exist('sMovieTitle')):
        sSiteUrl = params.getValue('movieUrl')
        sMovieTitle = params.getValue('sMovieTitle')
        sHtmlContent = __getHtmlContent(sUrl = sSiteUrl)
        sPattern = 'id="ame_noshow_post.*?<a href="([^"]+)" title="[^"]+" target="_blank">([^<]+)</a>'
        aResult = cParser().parse(sHtmlContent, sPattern)
        if aResult[0] == True:
            aHosters = []
            for aEntry in aResult[1]:
                sUrl = aEntry[0]
                # extract hoster domainname            
                if 'g-stream.in/secure/' in sUrl :
                    sHoster = sUrl.split('secure/')[-1].split('/')[0].split('.')[-2]
                else:
                    sHoster = sUrl.split('//')[-1].split('/')[0].split('.')[-2]
                hoster = {}
                hoster['link'] = sUrl
                hoster['name'] = sHoster
                hosters.append(hoster)
    hosters.append('getHosterUrl')
    return hosters
Exemplo n.º 19
0
def listVideos():
    oGui = cGui()

    oInputParameterHandler = ParameterHandler()
    if (oInputParameterHandler.exist('playlistId')):
        sPlaylistId = oInputParameterHandler.getValue('playlistId')

        if not oInputParameterHandler.exist('sUrl'):
            sUrl = URL_TV + str(sPlaylistId)
        else:
            sUrl = oInputParameterHandler.getValue('sUrl')
        

        if sPlaylistId == 'spieltag':
            oParser = cParser()
            if sUrl.find(URL_TV) != -1:
                sUrl = 'http://www.bundesliga.de/de/bundesliga-tv/index.php'
                oRequest = cRequestHandler(sUrl)
                sHtmlContent = oRequest.request()
                sPattern = '\'(/de/bundesliga-tv/navigation.php\?area=spieltag&saison=(\d+)[^\']+)\''
                aResult = oParser.parse(sHtmlContent, sPattern)
                sUrl = URL_MAIN + aResult[1][0][0]
                sSaison = aResult[1][0][1]
            else:
                sSaison = oParser.parse(sUrl, '&saison=(\d+)')[1][0]
            
            oRequest = cRequestHandler(sUrl)
            sHtmlContent = oRequest.request()
            
            sPattern = '<div class="matchDay matchDay[^<]*onclick="retrieveURL\(\'([^\']+)\'.*?>([^<]+)</div>'
            aResult = oParser.parse(sHtmlContent, sPattern)
            
            if (aResult[0] == True):                
                #ausgewählte Saison
                for aEntry in aResult[1]:
                    oGuiElement = cGuiElement()
                    oGuiElement.setSiteName(SITE_IDENTIFIER)
                    oGuiElement.setFunction('listVideos')
                    oGuiElement.setTitle(aEntry[1])

                    sUrl = URL_MAIN + str(aEntry[0])
                    oOutputParameterHandler = ParameterHandler()
                    oOutputParameterHandler.setParam('sUrl', sUrl)
                    oOutputParameterHandler.setParam('playlistId', 'spieltagEinzeln')
                    oGui.addFolder(oGuiElement, oOutputParameterHandler)
                
                #ältere Saison
                oGuiElement = cGuiElement()
                oGuiElement.setSiteName(SITE_IDENTIFIER)
                oGuiElement.setFunction('listVideos')
                lastSaison = str(int(sSaison) - 1)
                oGuiElement.setTitle('* Saison %s/%s *' % (lastSaison,sSaison))

                sUrl = sUrl.replace(sSaison, lastSaison)
                oOutputParameterHandler = ParameterHandler()
                oOutputParameterHandler.setParam('sUrl', sUrl)
                oOutputParameterHandler.setParam('playlistId', 'spieltag')
                oGui.addFolder(oGuiElement, oOutputParameterHandler)

            
        elif sPlaylistId == 'vereine':
            sPattern = '<div class="teamWappen" onclick="retrieveURL\(\'([^\']+)\'.*?<img src="([^"]+)" title="Videos des ([^"]+)" /></div>'
            oRequest = cRequestHandler(sUrl)
            sHtmlContent = oRequest.request()
           
            oParser = cParser()
            aResult = oParser.parse(sHtmlContent, sPattern)
            
            if (aResult[0] == True):
                for aEntry in aResult[1]:
                    oGuiElement = cGuiElement()
                    oGuiElement.setSiteName(SITE_IDENTIFIER)
                    oGuiElement.setFunction('listVideos')
                    oGuiElement.setTitle((aEntry[2]))
                    sThumbnail = URL_MAIN + str(aEntry[1])
                    oGuiElement.setThumbnail(sThumbnail)

                    sUrl = URL_MAIN + str(aEntry[0])
                    oOutputParameterHandler = ParameterHandler()
                    oOutputParameterHandler.setParam('sUrl', sUrl)
                    oOutputParameterHandler.setParam('playlistId', 'verein')
                    oGui.addFolder(oGuiElement, oOutputParameterHandler)
        else:
            sPattern = '<div class="zeile">.*?<img src="([^"]+)" id="bild" class="previewImg".*?<a href="javascript:showVideoSnippet\(\'([^\']+)\'\).*?title="([^"]+)".*?<div class="describe">(.*?)</div>'    
            oRequest = cRequestHandler(sUrl)
            sHtmlContent = oRequest.request()
            
            oParser = cParser()
            aResult = oParser.parse(sHtmlContent, sPattern)
            if (aResult[0] == True):
                for aEntry in aResult[1]:
                    sThumbnail = URL_MAIN + str(aEntry[0])
                    sUrl = URL_MAIN + str(aEntry[1])
                    sTitle = cUtil().unescape(str(aEntry[2]).decode('utf-8')).encode('utf-8') 
                    sDescription = cUtil().unescape(str(aEntry[3]).decode('utf-8')).encode('utf-8')
                    oGuiElement = cGuiElement()
                    oGuiElement.setSiteName(SITE_IDENTIFIER)
                    oGuiElement.setFunction('play')
                    oGuiElement.setTitle(sTitle)
                    oGuiElement.setDescription(sDescription)
                    oGuiElement.setThumbnail(sThumbnail)
                    
                    oOutputParameterHandler = ParameterHandler()
                    oOutputParameterHandler.setParam('sUrl', sUrl)
                    oOutputParameterHandler.setParam('sTitle', sTitle)
                    
                    oGui.addFolder(oGuiElement, oOutputParameterHandler, bIsFolder = False)
            oGui.setView('movies')
    oGui.setEndOfDirectory()
Exemplo n.º 20
0
 def play(self, siteResult=False):
     oGui = cGui()
     oInputParameterHandler = ParameterHandler()
     sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
     sFileName = oInputParameterHandler.getValue('sFileName')
     if not sFileName:
         sFileName = oInputParameterHandler.getValue('Title')
     if not sFileName:
         sFileName = oInputParameterHandler.getValue('title')
     if not sFileName: #nur vorrübergehend
         sFileName = oInputParameterHandler.getValue('sMovieTitle')
     sSeason = oInputParameterHandler.getValue('season')
     sEpisode = oInputParameterHandler.getValue('episode')
     sShowTitle = oInputParameterHandler.getValue('TvShowTitle')
     sThumbnail = oInputParameterHandler.getValue('thumb')       
     if siteResult:
         sMediaUrl = siteResult['streamUrl']
         logger.info('call play: ' + sMediaUrl)
         if siteResult['resolved']:
             sLink = sMediaUrl
         else:
             try:
                 sLink = urlresolver.resolve(sMediaUrl)
             except:
                 sLink = False
                 #raise
     elif sMediaUrl:
         logger.info('call play: ' + sMediaUrl)
         sLink = urlresolver.resolve(sMediaUrl)
     else:
         oGui.showError('xStream', 'Hosterlink not found', 5)
         return False
     if sLink != False:            
         logger.info('file link: ' + sLink)
         oGuiElement = cGuiElement()
         oGuiElement.setSiteName(self.SITE_NAME)
         oGuiElement.setMediaUrl(sLink)
         oGuiElement.setTitle(sFileName)
         if sThumbnail:
             oGuiElement.setThumbnail(sThumbnail)
         if sShowTitle:
             oGuiElement.addItemProperties('Episode',sEpisode)
             oGuiElement.addItemProperties('Season',sSeason)
             oGuiElement.addItemProperties('TvShowTitle',sShowTitle)
         #listItem = xbmcgui.ListItem(path=sLink)
         #listItem.setProperty('IsPlayable', 'true')
         #pluginHandle = cPluginHandler().getPluginHandle()
         #return xbmcplugin.setResolvedUrl(pluginHandle, True, listItem)
         oPlayer = cPlayer()
         oPlayer.clearPlayList()
         oPlayer.addItemToPlaylist(oGuiElement)
         if self.dialog:
             try:
                 self.dialog.close()
             except:
                 pass
         oPlayer.startPlayer()
     else:
         logger.info('file link: ' + str(sLink))
         oGui.showError('xStream', 'File deleted or Link could not be resolved', 5)
         return False
     return True 
def showEpisodes():
    oGui = cGui()
    oParams = ParameterHandler()
    sShowTitle = oParams.getValue('Title')
    sUrl = oParams.getValue('siteUrl')
    sImdb = oParams.getValue('imdbID')
    sSeason = oParams.getValue('Season')

    logger.info("%s: show episodes of '%s' season '%s' " %
                (SITE_NAME, sShowTitle, sSeason))

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

    sPattern = '<table>(.*?)</table>'
    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)
    if (aResult[0] == True):
        sHtmlContent = aResult[1][0]
        sPattern = '<td>([^<]+)</td>\s*<td><a href="([^"]+)">(.*?)</a>.*?<td class="nowrap">(\s*<a|\s*</td).*?</tr>'
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for aEntry in aResult[1]:
                if aEntry[3].strip() == '</td':
                    continue
                sNumber = str(aEntry[0]).strip()
                oGuiElement = cGuiElement('Episode ' + sNumber,
                                          SITE_IDENTIFIER, 'showHosters')
                if META == True and not sImdb == '':
                    oMetaget = metahandlers.MetaData()
                    meta = oMetaget.get_episode_meta(sShowTitle, sImdb,
                                                     sSeason, sNumber)
                    meta['TVShowTitle'] = sShowTitle
                    oGuiElement.setItemValues(meta)
                    oGuiElement.setThumbnail(meta['cover_url'])
                    oGuiElement.setFanart(meta['backdrop_url'])

                sPattern = '<strong>(.*?)</strong>'
                aResultTitle = oParser.parse(str(aEntry[2]), sPattern)
                if (aResultTitle[0] == True):
                    sTitleName = str(aResultTitle[1][0]).strip()
                else:
                    sPattern = '<span lang="en">(.*?)</span>'
                    aResultTitle = oParser.parse(str(aEntry[2]), sPattern)
                    if (aResultTitle[0] == True):
                        sTitleName = str(aResultTitle[1][0]).strip()
                    else:
                        sTitleName = ''
                sTitle = sNumber
                sTitleName = cUtil().unescape(
                    sTitleName.decode('utf-8')).encode('utf-8')
                oParams.setParam('EpisodeTitle', sTitleName)
                sTitle = sTitle + ' - ' + sTitleName

                oGuiElement.setTitle(sTitle)
                oParams.setParam('siteUrl', URL_MAIN + '/' + str(aEntry[1]))
                oParams.setParam('EpisodeNr', sNumber)

                oParams.setParam('Title',
                                 sShowTitle + ' - S' + sSeason + 'E' + sTitle)
                oGui.addFolder(oGuiElement, oParams, iTotal=len(aResult[1]))

    oGui.setView('episodes')
    oGui.setEndOfDirectory()