Ejemplo n.º 1
0
def _getEpisodesByHTML(htmlpage, castID, showError):
    """ zieht aus der html-datei die einzelnen Episoden-Urls
    """
    episoden = []
    
    rss = RSS20.RSS20(showError)
    rssBody = rss.getRSSObject(htmlpage)
    
    channelItem = rssBody.getItemWithName("channel")
    if channelItem:
        items = channelItem.getSubitemsWithName("item")
        for rssitem in items:
            titleitem     = rssitem.getSubitemWithName("title")
            enclosureitem = rssitem.getSubitemWithName("enclosure")
            guiditem      = rssitem.getSubitemWithName("guid")
            pubDateItem   = rssitem.getSubitemWithName("pubDate")
            if pubDateItem:
                pubDate = getEpisodeTime(pubDateItem.getContent())
            else:
                pubDate = time.gmtime(0)
            if enclosureitem:
                linkitem = enclosureitem.getSubitemWithName("url")
                if guiditem is False:
                    guiditem = linkitem
                if titleitem and linkitem:
                    episode = Episode.Episode(castID, -1, linkitem.getContent(), public_functions.f_replaceBadCharsByRegEx(titleitem.getContent()), 
                                              guiditem.getContent(), SQLs.episodestatus["new"], pubDate)
                    episoden.insert(0, episode)
    
    return episoden
Ejemplo n.º 2
0
def getCastNameByRSS(rssBody):
    if rssBody is not False:
        channelItem = rssBody.getItemWithName("channel")
        if channelItem:
            item = channelItem.getSubitemWithName("title")
            if item:
                name = public_functions.f_replaceBadCharsByRegEx(item.getContent())
                print(name)
                return name
    else:
        return ""