Esempio n. 1
0
 def loadBooks(self):
     i = 0
     books = []
     with open("book.txt", "r") as f:
         mylist = f.read().splitlines()
         for line in mylist:
             line.strip()
             books.append(line)
     while i < len(books):
         book = Book.PhysicalBook(books[i], books[i + 1], books[i + 2],
                                  books[i + 3], books[i + 4], books[i + 5],
                                  books[i + 6], books[i + 7], 0)
         bookObjects.append(book)
         i = i + 8
Esempio n. 2
0
def addBook():

    title = raw_input("Input title of the book: ")
    author = raw_input("Input author: ")
    subject = raw_input("Input subject: ")
    isbn = raw_input("Input ISBN number: ")
    date_added = time.strftime("%d/%m/%Y")
    time_added = datetime.datetime.now().strftime("%H:%M:%S")
    numCopies = raw_input("Input number of copies: ")
    which = int(raw_input("Enter 1 for eBook or 2 for a physical book: "))
    if (server.searchIsbn(isbn)):
        if (which == 2):
            inputBook = Book.PhysicalBook(title, author, subject, isbn,
                                          date_added, numCopies, time_added,
                                          "Never checked Out", 0)
        else:
            inputBook = Book.eBook(title, author, subject, isbn, date_added,
                                   numCopies, time_added, "Never checked Out",
                                   1)
        print("Book Added!")
        return inputBook, which
    else:
        print("Duplicate ISBN number, cannot add")
    return None, None