altescy / bookshelf

📓 Ebook management system with S3 compatible storage which provides OPDS feed.
https://hub.docker.com/r/altescy/bookshelf
MIT License
49 stars 4 forks source link

Automatically add books in a directory #2

Open ligurio opened 4 years ago

ligurio commented 4 years ago

It would be nice to automatically add books in a directory. Now it is possible to add book one by one manually. It's time consuming and boring.

P.S. First of all thanks for sharing source code of bookshelf! It looks very promising. I don't like Calibre and wants something to build OPDS catalog with my books, bookshelf looks interesting.

altescy commented 3 years ago

@ligurio

Thank you for using this application.

At the present time, we need to manually input metadata of a book (title, author, etc.) to register into this application. This is a trouble work as you say.

To realize automatic registration of multiple books, we need to implement a function to extract metadata from a book file. But, I don't familiar with internal information of a book file such as pdf and epub. Do you have any ideas or a better solution of this?

ligurio commented 3 years ago

@altescy

But, I don't familiar with internal information of a book file such as pdf and epub. Do you have any ideas or a better solution of this?

EPUB is actually a zip archive with XML documents inside. Metadata stored in XML document too. I found a couple of packages to extract epub metadata: epub and epubgo (this looks promising). Both requires testing.

PDF is a binary format. I would suggest unipdf package to extract metadata from it. Take a look on examples - https://github.com/unidoc/unipdf-examples/tree/master/metadata

altescy commented 3 years ago

@ligurio

Currently bookshelf support the following file formats: azw3, epub, fb2, mobi, pdf, txt.

How about azw3, fb2, and mobi? It would be awesome if you could tell me some promising packages for these file formats. (For text file, I plan to use file name as a book title.)

I'm going to implement this feature for future release. Thank you for your suggestion!

altescy commented 3 years ago

I found packages for mobi and fb2:

ligurio commented 3 years ago

I don't know any suitable package for azw3 format, but it can be possible to convert azw3 to fb2 and use fb package to extract metadata.

ckuethe commented 3 years ago

To add to this feature request, it would be nice to recursively scan a directory, even to just barely populate the database with filename, size, and sha256.

I've already scanned all the books and built a json file full of metadata, and I could very easily update the bookshelf database with missing metadata either by directly editing the database or using the API

marek-lach commented 3 years ago

I found packages for mobi and fb2:

* mobi: https://github.com/clee/gobipocket

* fb2: https://github.com/centrypoint/fb2

Other, currently updated fb2 parsers for go that could be used:

https://github.com/karantin2020/go-fb2

or

https://github.com/vdovindima/fb2

or https://github.com/rupor-github/fb2converter also provides .mobiconversion capabilities too.