Пример #1
0
def get_imdb_search_result(body):
    all_tr = regex_get_all(body, '<tr class=', '</tr>')
    
    movies = []
    for tr in all_tr:
        all_td = regex_get_all(tr, '<td', '</td>')
        imdb_id = regex_from_to(all_td[1], '/title/', '/')
        name = regex_from_to(all_td[1], '/">', '</a>')
        year = regex_from_to(all_td[1], '<span class="year_type">\(', '\)')
        rating = regex_from_to(all_td[2], '<b>', '</b>')
        votes = regex_from_to(all_td[3], '\n', '\n')
        movies.append({'imdb_id': imdb_id, 'name': name, 'year': year, 'rating': rating, 'votes': votes})
    return movies            
Пример #2
0
 def episodes(self):
     episodes = []
     episodes_info = regex_get_all(self.info_result, '<Episode>',
                                   '</Episode>')
     for episode_info in episodes_info:
         episodes.append(TheTVDBEpisode(episode_info))
     return episodes
Пример #3
0
def scrape_xspf(body):
    all_track = regex_get_all(body, '<track>', '</track>')
    tracks = []
    for track in all_track:
        name = regex_from_to(track, '<title>', '</title>')
        location = regex_from_to(track, '<location>', '</location>')
        tracks.append({'name': name, 'location': location})
    return tracks
Пример #4
0
def subscription_imdb(name,url):
    if os.path.isfile(SUB_IMDB_FILE):
        existing = read_from_file(SUB_IMDB_FILE)
    if os.path.isfile(SUB_FILE):
        s = read_from_file(SUB_FILE)
        show_list = s.split('\n')
        for show in show_list:
            if show != '' and not show in existing:
                dialog = xbmcgui.Dialog()
                menu_texts = []
                menu_data = []
                params = {}
                params["title"] = show
                params["view"] = "simple"
                params["count"] = "10"
                params["title_type"] = "tv_series,mini_series,tv_special"
                url = "%s%s" % ("http://www.imdb.com/search/title?", urllib.urlencode(params))
                body = open_url(url)
 	
                first_show = regex_get_all(body, '<tr class=', '</tr>')
                if len(first_show) == 565:
                    all_td = regex_get_all(first_show, '<td', '</td>')
                    imdb_id = regex_from_to(all_td[1], '/title/', '/')
                else:
                    for f in first_show:
                        all_td = regex_get_all(f, '<td', '</td>')#year_type">
                        imdb_id = regex_from_to(all_td[1], '/title/', '/')#/">
                        title = regex_from_to(all_td[1], '/">', '</a').replace("&#x27;", "'") + ' ' + regex_from_to(f, 'year_type">', '</span>')
                        menu_data.append(imdb_id)
                        menu_texts.append(title)
                    menu_id = dialog.select('Select Show', menu_texts)
                    if(menu_id < 0):
                        return (None, None)
                        dialog.close()
                    else:	
                        imdb_id = menu_data[menu_id]
                text="%s<>%s" % (show,imdb_id)
                add_to_list(text, SUB_IMDB_FILE)
            else:
                notification('My Subsciptions', 'No new shows found', '3000', iconart)
        get_subscriptions(name,url)
Пример #5
0
 def episodes(self):
     episodes = []
     episodes_info = regex_get_all(self.info_result, '<Episode>', '</Episode>')
     for episode_info in episodes_info:
         episodes.append(TheTVDBEpisode(episode_info))
     return episodes