def run_demo():
    search_with_attr = True  #Change this to true to search by attribute

    slug = 'KO'
    if search_with_attr:
        attribute = "The Innkeeper Chronicles, Volume One"
        bookSite = get_book_site(slug)
        book_site_data = SiteBookData(book_title=attribute)
        matches = bookSite.find_book_matches_at_site(book_site_data)
        for book in matches:
            print(
                "======================================================================================="
            )
            print("Score: ", str(book[0]))
            book[1].print_all()

    else:
        book_site = get_book_site(slug)  # seed Book Site object with slug
        url = "https://www.kobo.com/us/en/audiobook/the-lion-the-witch-and-the-wardrobe-16"
        book_site_data = book_site.get_book_data_from_site(
            url)  # Parse data from site
        book_site_data.site_slug = slug
        matches = book_site.find_book_matches_at_site(
            book_site_data)  # Get book matches
        for book in matches:
            print(
                "======================================================================================="
            )
            print("Score: ", str(book[0]))
            book[1].print_all()
Exemple #2
0
def run_demo():
    search_with_attr = True  #Change this to true to search by attribute

    slug = 'LC'  # Declare slug for site to search
    book_site = get_book_site(slug)  # seed Book Site object with slug
    if search_with_attr:
        attribute = "a fenda"
        bookSite = get_book_site(slug)
        book_site_data = SiteBookData(book_title=attribute)
        matches = bookSite.find_book_matches_at_site(book_site_data)
        for book in matches:
            print(
                "======================================================================================="
            )
            print("Score: ", str(book[0]))
            book[1].print_all()
    else:
        url = "https://www3.livrariacultura.com.br/it-46337781/p"
        book_site_data = book_site.get_book_data_from_site(
            url)  # Parse data from site
        book_site_data.print_all()
        book_site_data.site_slug = slug
        matches = book_site.find_book_matches_at_site(
            book_site_data)  # Get book matches
        for book in matches:
            print(
                "======================================================================================="
            )
            print("Score: ", str(book[0]))
            book[1].print_all()
Exemple #3
0
def run_demo():
    search_with_attr = False  #Change this to true to search by attribute

    slug = 'AU'
    if search_with_attr:
        attribute = "The Innkeeper Chronicles, Volume One"
        bookSite = get_book_site(slug)
        book_site_data = SiteBookData(book_title=attribute)
        matches = bookSite.find_book_matches_at_site(book_site_data)
        for book in matches:
            print(
                "======================================================================================="
            )
            print("Score: ", str(book[0]))
            book[1].print_all()

    else:
        book_site = get_book_site(slug)  # seed Book Site object with slug
        url = "https://www.audiobooks.com/audiobook/lord-halifaxs-ghost-book/206304"
        book_site_data = book_site.get_book_data_from_site(
            url)  # Parse data from site
        book_site_data.print_all()
        matches = book_site.find_book_matches_at_site(
            book_site_data)  # Get book matches
        for book in matches:
            print(
                "======================================================================================="
            )
            print("Score: ", str(book[0]))
            book[1].print_all()
def run_demo():
    search_with_attr=True #Change this to true to search by attribute


    slug = 'GB'
    if search_with_attr:
        attribute="The Lord"
        bookSite = get_book_site(slug)
        book_site_data = SiteBookData(book_title = attribute)
        matches = bookSite.find_book_matches_at_site(book_site_data) # Get book matches
        for book in matches:
            print("=======================================================================================")
            print("Score: ", str(book[0]))
            book[1].print_all()

    else:
        book_site = get_book_site(slug) # seed Book Site object with slug
        url = "https://www.google.com/books/edition/The_Lord/eyK309uZ9o8C?hl=en"
        book_site_data = book_site.get_book_data_from_site(url) # Parse data from site
        book_site_data.print_all()
        matches = book_site.find_book_matches_at_site(book_site_data) # Get book matches
        for book in matches:
            print("=======================================================================================")
            print("Score: ", str(book[0]))
            book[1].print_all()
Exemple #5
0
def KO_demo():
    slug = 'KO' # Declare slug for site to search
    book_site = get_book_site(slug) # seed Book Site object with slug
    url = "https://www.kobo.com/ca/en/ebook/the-lion-the-witch-and-the-wardrobe-1"
    book_site_data = book_site.get_book_data_from_site(url) # Parse data from site
    book_site_data.site_slug = slug
    matches = book_site.find_book_matches_at_site(book_site_data) # Get book matches
    for book in matches:
        print("score", str(book[0]))
        book[1].print_all()
Exemple #6
0
def TB_demo():
    slug = 'TB' # Declare slug for site to search
    book_site = get_book_site(slug) # seed Book Site object with slug
    url = "http://127.0.0.1:8000/5000/"
    book_site_data = book_site.get_book_data_from_site(url) # Parse data from site
    book_site_data.site_slug = slug
    matches = book_site.find_book_matches_at_site(book_site_data) # Get book matches
    for book in matches:
        print("score", str(book[0]))
        book[1].print_all()
Exemple #7
0
def AU_demo():
    slug = 'AU' # Declare slug for site to search
    book_site = get_book_site(slug) # seed Book Site object with slug
    url = "https://www.audiobooks.com/audiobook/blindside/405228"
    book_site_data = book_site.get_book_data_from_site(url) # Parse data from site
    book_site_data.site_slug = slug
    matches = book_site.find_book_matches_at_site(book_site_data) # Get book matches
    for book in matches:
        print("=======================================================================================")
        print("Score: ", str(book[0]))
        book[1].print_all()
Exemple #8
0
def GB_demo():
    slug = 'GB' # Declare slug for site to search
    book_site = get_book_site(slug) # seed Book Site object with slug
    url = "https://books.google.com/books?id=_FjrugAACAAJ&dq=the+lord+of+the+rings&hl=en&newbks=1&newbks_redir=0&sa=X&ved=2ahUKEwiNrsjcyuPoAhVNd6wKHeHkCsgQ6AEwAHoECAAQAg"
    book_site_data = book_site.get_book_data_from_site(url) # Parse data from site
    book_site_data.site_slug = slug
    matches = book_site.find_book_matches_at_site(book_site_data) # Get book matches
    for book in matches:
        print("=======================================================================================")
        print("Score: ", str(book[0]))
        book[1].print_all()
Exemple #9
0
def LC_demo():
    slug = 'LC' # Declare slug for site to search
    book_site = get_book_site(slug) # seed Book Site object with slug
    url = "https://www3.livrariacultura.com.br/it-46337781/p"
    book_site_data = book_site.get_book_data_from_site(url) # Parse data from site
    book_site_data.site_slug = slug
    matches = book_site.find_book_matches_at_site(book_site_data) # Get book matches
    for book in matches:
        print("=======================================================================================")
        print("Score: ", str(book[0]))
        book[1].print_all()
Exemple #10
0
def SC_demo():
    slug = 'SC' # Declare slug for site to search
    book_site = get_book_site(slug) # seed Book Site object with slug
    url = "https://www.scribd.com/book/205512285/A-Series-of-Unfortunate-Events-1-The-Bad-Beginning"
    book_site_data = book_site.get_book_data_from_site(url) # Parse data from site
    book_site_data.site_slug = slug
    matches = book_site.find_book_matches_at_site(book_site_data) # Get book matches
    for book in matches:
        print("=======================================================================================")
        print("Score: ", str(book[0]))
        book[1].print_all()
Exemple #11
0
def searchHandler(searchSbd):

    if searchSbd == '':
        print("No valid attributes to search with")
        return 'F'

    valid_attr_count = 0
    # Used to ensure the sbd has at least
    # one attribute that can be used to search

    if searchSbd.book_title != '':
        valid_attr_count += 1
    elif searchSbd.isbn_13 != '':
        valid_attr_count += 1
    elif searchSbd.series != '':
        valid_attr_count += 1
    elif searchSbd.authors != '':
        valid_attr_count += 1
    elif searchSbd.subtitle != '':
        valid_attr_count += 1

    if valid_attr_count > 0:  # Launch Search after ensuring there is a slug
        # Make sure there is a valid site slug
        slug = searchSbd.site_slug.upper()
        # Every object "should" have a slug, but this is just in case
        if slug != 'KO' and slug != 'GO' and slug != 'TB' and slug != 'LC' and slug != 'SC' and slug != 'AU':
            while slug != 'KO' and slug != 'GO' and slug != 'TB' and slug != 'LC' and slug != 'SC' and slug != 'AU':
                # if no valid slug, prompt user for new slug.
                slug = input("No valid slug to search with. Add one now.")
                searchSbd.slug = slug  # Set new slug

        # SBD should be valid now. Launch search
        book_site = get_book_site(searchSbd.site_slug)
        matches = book_site.find_book_matches_at_site(searchSbd)
        for book in matches:
            print("score", str(book[0]))
            book[1].print_all()

    else:  # Fail. No valid attributes to search with
        print("No valid attributes to search with")
        return 'F'
Exemple #12
0
def run_demo():
    search_with_attr = True  #Change this to true to search by attribute
    slug = 'TB'  # Declare slug for site to search
    book_site = get_book_site(slug)  # seed Book Site object with slug
    if search_with_attr:
        attribute = ["N.W. Moors"]
        book_site_data = SiteBookData(authors=attribute)
        matches = book_site.find_book_matches_at_site(
            book_site_data)  # Get book matches in a list of tuples
        for book in matches:
            print("score", str(book[0]))
            book[1].print_all()

    else:
        url = "http://127.0.0.1:8000/5000/"
        book_site_data = book_site.get_book_data_from_site(
            url)  # Parse data from site
        book_site_data.site_slug = slug
        matches = book_site.find_book_matches_at_site(
            book_site_data)  # Get book matches in a list of tuples
        for book in matches:
            print("score", str(book[0]))
            book[1].print_all()