{ claus.conrad }

Calibre

https://calibre-ebook.com/

Calibre is a powerful, user-friendly and completely free [open source](…/open source/) software for managing e-books on [Windows](…/Microsoft Windows/), macOS and Linux. It is written in and extensible using Python.

FAQ

Adding a book programmatically

  1. Save as a file:
    import calibre.ebooks.metadata.meta
    import calibre.library
    
    db = calibre.library.db('/path/to/library').new_api
    
    path = "/path/to/book.epub"
    
    md = calibre.ebooks.metadata.meta.get_metadata(
    	open(path, "rb"),
    	stream_type="epub",
    )
    
    db.add_books(
    	[
    		(
    			md,
    			{
    				"EPUB": path,
    			}
    		)
    	]
    )
    
2. Run the file using `calibre-debug`:
	```shell
	calibre-debug something.py
	```