bookshelf icon indicating copy to clipboard operation
bookshelf copied to clipboard

Automatically add books in a directory

Open ligurio opened this issue 4 years ago • 7 comments

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.

ligurio avatar Oct 08 '20 12:10 ligurio

@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?

altescy avatar Oct 09 '20 08:10 altescy

@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

ligurio avatar Oct 09 '20 09:10 ligurio

@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 avatar Oct 09 '20 10:10 altescy

I found packages for mobi and fb2:

  • mobi: https://github.com/clee/gobipocket
  • fb2: https://github.com/centrypoint/fb2

altescy avatar Oct 09 '20 13:10 altescy

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.

ligurio avatar Oct 09 '20 13:10 ligurio

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

ckuethe avatar Aug 12 '21 03:08 ckuethe

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.

marek-lach avatar Sep 10 '21 11:09 marek-lach