Пример #1
0
def test(test_func):
    band, expected = test_func()
    
    album_page_names = discog.parse_discog_section(site, band, "Discography")
    for expected_name in expected[:]:
        if expected_name in album_page_names:
            album_page_names.remove(expected_name)
            expected.remove(expected_name)
    
    print "{0} RESULT".format(band)
    
    if expected:
        print "Did not find the following expected pages:"
        for expected_name in expected:
            print expected_name
        print
    
    if album_page_names:
        print "Found the following unexpected pages:"
        for album_page_name in album_page_names:
            print album_page_name
    
    if not expected and not album_page_names:
        print "SUCCESS"
    
    print
Пример #2
0
def search_artist(artist_name):
	query = "intitle:{artist}".format(artist=artist_name)
	page_titles = [result["title"] for result in site.search(query, what="text")]
	page_title_map = {title.lower():title for title in page_titles}
	
	artist_page, discog_page = filter_search_results(page_title_map, artist_name.lower())
	
	# return get_album_pages(artist_page)
	discog_info = get_discog_info(artist_page)
	if discog_info.page:
		return discog.parse_discog_page(discog_info.page)
	else:
		return discog.parse_discog_section(discog_info.section)
Пример #3
0
def get_album_pages(artist_page):
	discog_info = get_discog_info(artist_page)
	if discog_info.page:
		return discog.parse_discog_page(discog_info.page)
	else:
		return discog.parse_discog_section(discog_info.section)