Ejemplo n.º 1
0
def new_book():
    '''Get info from user, add new book'''
    new_book = ui.get_new_book_info()
    if datastore.check_read(new_book):
        ui.message('THIS BOOK IS A DUPLICATE OF ANOTHER BOOK IN THE SYSTEM!')
    datastore.add_book(new_book)
    ui.message('Book added: ' + str(new_book))
Ejemplo n.º 2
0
def add_new_book():
    """Get info from user, add new book"""
    title_and_author = ui.get_new_book_info()
    new_book = book.Book(title_and_author[0], title_and_author[1])
    datastore.add_book(new_book)
    ui.message('Book added: ' + new_book.get_title())
    warn_if_previously_read(new_book.title)
Ejemplo n.º 3
0
def new_book():
    """Get info from user, add new book"""
    n_book = ui.get_new_book_info()
    if datastore.check_book(n_book):
        ui.message('Hey man you read this book already!')
    datastore.add_book(n_book)
    ui.message('Book added: ' + str(n_book))
Ejemplo n.º 4
0
def edit_book():
    """ edits book in book list """
    show_read()
    book_id = int(input("Which book would you like to edit? "))
    book = datastore.get_book(book_id)
    if book:
        n_book = ui.get_new_book_info()
        datastore.add_book(n_book)
        ui.message('Book added: ' + str(n_book))
Ejemplo n.º 5
0
def new_book():
    """Get info from user, add new book"""
    new_book = ui.get_new_book_info()
    if datastore.check_duplicate(new_book.title,
                                 new_book.author):  #True if duplicate exists
        if ui.get_input(
                "Book with same title and author was already added.  To add anyway, type y."
        ).lower()[0] != "y":
            ui.message("entry canceled")
    else:
        datastore.add_book(new_book)
        ui.message('Book added: ' + str(new_book))
Ejemplo n.º 6
0
def new_book():
    '''Get info from user, add new book'''
    # calling the fuction getNewBookInfo from ui
    new_book = ui.get_new_book_info()
    # calling function from datastore to addBook to its list
    if datastore.add_book(new_book, True):
        # output for user
        ui.message('Book added: ' + str(new_book))
    else:
        ui.message("The book has not been added again.")
Ejemplo n.º 7
0
def new_book():
    '''Get info from user, add new book'''
    global counter

    new_book = ui.get_new_book_info()

    #print('in new_book')
    #print(new_book)

    counter = datastore.add_book(new_book, counter)
    ui.message('Book added: ' + str(new_book))
Ejemplo n.º 8
0
def new_book():
    '''Get info from user, add new book'''
    new_book = ui.get_new_book_info()
    datastore.add_book(new_book)
    ui.message('Book added: ' + str(new_book))