def create(self, filepath): """Load the given file. Return a book object.""" p = Pdf(filepath) b = Book() try: p.load() b.title = p.title b.author = p.author self.__add_format(b, filepath) except FileNotFoundError: b = None return b
def __get_mock_book(self): b = Book() b.id = 1414 b.title = "Title" b.author = "An Author" b.author_uri = "about:none" f = BookFormat() b.formats = [f, f, f] return b
def __get_treasure_island(self): b = Book() b.id = "1" b.title = "Treasure Island" b.author = "Robert Louis Stevenson" return b
def __get_great_expectations(): b = Book() b.author = "Charles Dickens" b.author = "Great Expectations" return b
def __get_treasure_sland(): b = Book() b.author = "Robert Louis Stevenson" b.title = "Treasure Island" return b
def __get_book(self): my_book = Book() my_book.id = 1337 return my_book
def __convert_search_result_to_book(self, books, result): b = Book() b.id, b.title, b.author = result self.__add_formats_to_book(b) books.append(b)