Beispiel #1
0
def __retrieve_tv_shows__(tv_channel_url):
    tv_channel = {}
    tv_channel["running_tvshows"] = []
    tv_channel["finished_tvshows"] = []
    
    logging.getLogger().debug('TV Channel URL: ' + tv_channel_url)
    tv_shows = tv_channel["running_tvshows"]
    if tv_channel_url is None:
        return tv_shows
    tv_channel_url = BASE_WSITE_URL + tv_channel_url
    logging.getLogger().debug(tv_channel_url)
    contentDiv = BeautifulSoup.SoupStrainer('li', {'class':'categories'})
    soup = HttpClient().get_beautiful_soup(url=tv_channel_url, parseOnlyThese=contentDiv)
#     soup = BeautifulSoup.BeautifulSoup(HttpClient().get_html_content(url=tv_channel_url)).findAll('div', {'id':'forumbits', 'class':'forumbits'})[0]
    for title_tag in soup.findAll('li'):
        aTag = title_tag.findNext('a')
        tv_show_url = str(aTag['href'])
        if tv_show_url[0:4] != "http":
            tv_show_url = BASE_WSITE_URL + '/' + tv_show_url
        tv_show_name = aTag.getText()
        if not re.search('Completed Shows', tv_show_name, re.IGNORECASE):
            tv_shows.append({"name":http.unescape(tv_show_name), "url":tv_show_url, "iconimage":""})
        else:
            tv_shows = tv_channel["finished_tvshows"]
    return tv_channel
Beispiel #2
0
def __retrieve_tv_shows__(tv_channel_url):
    tv_channel = {}
    tv_channel["running_tvshows"] = []
    tv_channel["finished_tvshows"] = []

    logging.getLogger().debug('TV Channel URL: ' + tv_channel_url)
    tv_shows = tv_channel["running_tvshows"]
    if tv_channel_url is None:
        return tv_shows
    tv_channel_url = BASE_WSITE_URL + tv_channel_url
    logging.getLogger().debug(tv_channel_url)
    contentDiv = BeautifulSoup.SoupStrainer('li', {'class': 'categories'})
    soup = HttpClient().get_beautiful_soup(url=tv_channel_url,
                                           parseOnlyThese=contentDiv)
    #     soup = BeautifulSoup.BeautifulSoup(HttpClient().get_html_content(url=tv_channel_url)).findAll('div', {'id':'forumbits', 'class':'forumbits'})[0]
    for title_tag in soup.findAll('li'):
        aTag = title_tag.findNext('a')
        tv_show_url = str(aTag['href'])
        if tv_show_url[0:4] != "http":
            tv_show_url = BASE_WSITE_URL + '/' + tv_show_url
        tv_show_name = aTag.getText()
        if not re.search('Completed Shows', tv_show_name, re.IGNORECASE):
            tv_shows.append({
                "name": http.unescape(tv_show_name),
                "url": tv_show_url,
                "iconimage": ""
            })
        else:
            tv_shows = tv_channel["finished_tvshows"]
    return tv_channel
Beispiel #3
0
def __retrieveTVShowEpisodes__(threads, tv_show_name, channel_type, channel_name):
    tv_show_episode_items = []
    logging.getLogger().debug(threads)
    if threads is None:
        return []
    for thread in threads:
        aTag = thread.findNext('a')
        episodeName = aTag.getText()
        titleInfo = http.unescape(episodeName)
        titleInfo = titleInfo.replace(tv_show_name, '')
        titleInfo = titleInfo.replace('Full Episode Watch Online', '')
        titleInfo = titleInfo.replace('Watch Online', '')
        titleInfo = titleInfo.strip()

        item = xbmcgui.ListItem(label=titleInfo)
        
        episode_url = str(aTag['href'])
        if not episode_url.lower().startswith(BASE_WSITE_URL):
            if episode_url[0] != '/':
                episode_url = '/' + episode_url
            episode_url = BASE_WSITE_URL + episode_url
        item.setProperty('tv-show-name', tv_show_name)
        item.setProperty('channel-type', channel_type)
        item.setProperty('channel-name', channel_name)
        item.setProperty('episode-name', titleInfo)
        item.setProperty('episode-url', episode_url)
        tv_show_episode_items.append(item)
        
    return tv_show_episode_items
Beispiel #4
0
def __retrieveTVShowEpisodes__(threads, tv_show_name, channel_type,
                               channel_name):
    tv_show_episode_items = []
    logging.getLogger().debug(threads)
    if threads is None:
        return []
    for thread in threads:
        aTag = thread.findNext('a')
        episodeName = aTag.getText()
        titleInfo = http.unescape(episodeName)
        titleInfo = titleInfo.replace(tv_show_name, '')
        titleInfo = titleInfo.replace('Full Episode Watch Online', '')
        titleInfo = titleInfo.replace('Watch Online', '')
        titleInfo = titleInfo.strip()

        item = xbmcgui.ListItem(label=titleInfo)

        episode_url = str(aTag['href'])
        if not episode_url.lower().startswith(BASE_WSITE_URL):
            if episode_url[0] != '/':
                episode_url = '/' + episode_url
            episode_url = BASE_WSITE_URL + episode_url
        item.setProperty('tv-show-name', tv_show_name)
        item.setProperty('channel-type', channel_type)
        item.setProperty('channel-name', channel_name)
        item.setProperty('episode-name', titleInfo)
        item.setProperty('episode-url', episode_url)
        tv_show_episode_items.append(item)

    return tv_show_episode_items
Beispiel #5
0
def __retrieveTVShowEpisodes__(threads, tv_show_name, channel_type, channel_name):
    tv_show_episode_items = []
    logging.getLogger().debug(threads)
    if threads is None:
        return []
    aTags = threads.findAll('a', {'class':re.compile(r'\btitle\b')})
    logging.getLogger().debug(aTags)
    videoEpisodes = []
    for aTag in aTags:
        episodeName = aTag.getText()
        if not re.search(r'\b(Watch|Episode|Video|Promo)\b', episodeName, re.IGNORECASE):
            pass
        else:
            videoEpisodes.append(aTag)
            
    if len(videoEpisodes) == 0:
        videoEpisodes = aTags
        
    for aTag in videoEpisodes:
        episodeName = aTag.getText()
        titleInfo = http.unescape(episodeName)
        titleInfo = titleInfo.replace(tv_show_name, '')
        titleInfo = titleInfo.replace(' - Video Watch Online', '')
        titleInfo = titleInfo.replace(' - Video Watch online', '')
        titleInfo = titleInfo.replace('Video Watch Online', '')
        titleInfo = titleInfo.replace('Video Watch online', '')
        titleInfo = titleInfo.replace('Watch Online', '')
        titleInfo = titleInfo.replace('Watch online', '')
        titleInfo = titleInfo.replace('Watch', '')      
        titleInfo = titleInfo.replace('Video', '')
        titleInfo = titleInfo.replace('video', '')
        titleInfo = titleInfo.replace('-', '')
        titleInfo = titleInfo.replace('/ Download', '')
        titleInfo = titleInfo.replace('/Download', '')
        titleInfo = titleInfo.replace('Download', '')
        titleInfo = titleInfo.strip()
        
        item = xbmcgui.ListItem(label=titleInfo)
        
        episode_url = str(aTag['href'])
        if not episode_url.lower().startswith(BASE_WSITE_URL):
            if episode_url[0] != '/':
                episode_url = '/' + episode_url
            episode_url = BASE_WSITE_URL + episode_url
        item.setProperty('tv-show-name', tv_show_name)
        item.setProperty('channel-type', channel_type)
        item.setProperty('channel-name', channel_name)
        item.setProperty('episode-name', titleInfo)
        item.setProperty('episode-url', episode_url)
        tv_show_episode_items.append(item)
        
    return tv_show_episode_items
Beispiel #6
0
def __retrieve_tv_shows__(tv_channel_url):
    tv_shows = []
    if tv_channel_url is None:
        return tv_shows
    tv_channel_url = BASE_WSITE_URL + tv_channel_url
    contentDiv = BeautifulSoup.SoupStrainer('div', {'class':'all-tv-shows'})
    soup = HttpClient().get_beautiful_soup(url=tv_channel_url, parseOnlyThese=contentDiv, accept_500_error=True)
    list_item = soup.find('ul')
    for item in list_item.findChildren('li'):
        aTag = item.findChild('a')
        
        tv_show_url = str(aTag['href'])
        if tv_show_url[0:4] != "http":
            tv_show_url = BASE_WSITE_URL + '/' + tv_show_url
        tv_show_name = aTag.getText()
        tv_shows.append({"name":http.unescape(tv_show_name), "url":tv_show_url, "iconimage":""})
    return tv_shows
Beispiel #7
0
def __retrieve_tv_shows__(tv_channel_url):
    tv_shows = []
    if tv_channel_url is None:
        return tv_shows
    tv_channel_url = BASE_WSITE_URL + tv_channel_url
    contentDiv = BeautifulSoup.SoupStrainer("div", {"class": "all-tv-shows"})
    soup = HttpClient().get_beautiful_soup(url=tv_channel_url, parseOnlyThese=contentDiv, accept_500_error=True)
    list_item = soup.find("ul")
    for item in list_item.findChildren("li"):
        aTag = item.findChild("a")

        tv_show_url = str(aTag["href"])
        if tv_show_url[0:4] != "http":
            tv_show_url = BASE_WSITE_URL + "/" + tv_show_url
        tv_show_name = aTag.getText()
        tv_shows.append({"name": http.unescape(tv_show_name), "url": tv_show_url, "iconimage": ""})
    return tv_shows
Beispiel #8
0
def __retrieve_tv_shows__(tv_channel_url):
    logging.getLogger().debug(tv_channel_url)
    tv_shows = []
    if tv_channel_url is None:
        return tv_shows
    tv_channel_url = BASE_WSITE_URL + tv_channel_url
    logging.getLogger().debug(tv_channel_url)
    soup = BeautifulSoup.BeautifulSoup(HttpClient().get_html_content(url=tv_channel_url)).findAll('div', {'id':'forumbits', 'class':'forumbits'})[0]
    for title_tag in soup.findAll('h2', {'class':'forumtitle'}):
        aTag = title_tag.find('a')
        tv_show_url = str(aTag['href'])
        if tv_show_url[0:4] != "http":
            tv_show_url = BASE_WSITE_URL + '/' + tv_show_url
        tv_show_name = aTag.getText()
        if not re.search('Past Shows', tv_show_name, re.IGNORECASE):
            tv_shows.append({"name":http.unescape(tv_show_name), "url":tv_show_url, "iconimage":""})
    return tv_shows
Beispiel #9
0
def __retrieve_tv_shows__(tv_channel_url):
    tv_shows = []
    if tv_channel_url is None:
        return tv_shows
    tv_channel_url = BASE_WSITE_URL + tv_channel_url
    contentDiv = BeautifulSoup.SoupStrainer('div', {'class': 'all-tv-shows'})
    soup = HttpClient().get_beautiful_soup(url=tv_channel_url,
                                           parseOnlyThese=contentDiv,
                                           accept_500_error=True)
    list_item = soup.find('ul')
    for item in list_item.findChildren('li'):
        aTag = item.findChild('a')

        tv_show_url = str(aTag['href'])
        if tv_show_url[0:4] != "http":
            tv_show_url = BASE_WSITE_URL + '/' + tv_show_url
        tv_show_name = aTag.getText()
        tv_shows.append({
            "name": http.unescape(tv_show_name),
            "url": tv_show_url,
            "iconimage": ""
        })
    return tv_shows