Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calibre catalog import #627

Closed
tastytea opened this issue Feb 21, 2021 · 9 comments
Closed

Calibre catalog import #627

tastytea opened this issue Feb 21, 2021 · 9 comments
Labels
books enhancement New feature or request good first issue Good for newcomers

Comments

@tastytea
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I'd like to import a list of books and their metadata from calibre.

Describe the solution you'd like
Calibre can export a catalog of a library in different formats, for example CSV or XML. I think using the CSV would be easiest because the Goodreads-import already uses it?

Additional context
Example entry in a calibre catalog (CSV):

authors,author_sort,rating,library_name,timestamp,formats,size,isbn,identifiers,comments,tags,series,series_index,languages,title,cover,title_sort,publisher,pubdate,id,uuid
"Seanan McGuire","McGuire, Seanan","5","Bücher","2021-01-19T22:41:16+01:00","epub, original_epub","1433809","9780756411800","goodreads:39077187,isbn:9780756411800","REPLACED COMMENTS (BOOK DESCRIPTION) BECAUSE IT IS REALLY LONG.","Cryptids, Fantasy, Romance, Magic","InCryptid","8.0","eng","That Ain't Witchcraft","/home/tastytea/Bücher/Seanan McGuire/That Ain't Witchcraft (864)/cover.jpg","That Ain't Witchcraft","Daw Books","2019-03-05T01:00:00+01:00","864","3051ed45-8943-4900-a22a-d2704e3583df"

The comments field I replaced the text of seems to be text/plain. It can contain newlines.

@mouse-reeve mouse-reeve added books enhancement New feature or request labels Feb 21, 2021
@mouse-reeve mouse-reeve added the good first issue Good for newcomers label Mar 5, 2021
@Ryuno-Ki
Copy link
Contributor

I took a stab on this issue today, but somehow missed something:

calibre-import

You can see a diff here: https://jaenis.ch/hobbies/coding/repos/ryuno-ki/bookwyrm/compare/main...calibre-import

From what I can guess, some fields couldn't be mapped.
However, the console output does not yield any details. Can someone lend me a hand here?

@mouse-reeve
Copy link
Member

In that table, the data shown is normalized data, so the fact that is has the title, author, and ISBN means it's probably being mapped correctly. I wonder if the problem isn't directly related to your code, which looks correct to me at a glance, but a problem with how your local instance is connecting to external data sources?

If you do a search for that ISBN in your instance from the top bar, do you see results locally, from OpenLibrary, and/or from Inventaire?

@Ryuno-Ki
Copy link
Contributor

I don't get any for this ISBN. It works in general, though (ISBN 9780545010221 )

grafik

This is a development environment.

@mouse-reeve
Copy link
Member

That ISBN isn't in OpenLibrary, and may have timed out connecting to inventaire. I don't think it's a bug in your code, just a quirk of the imperfect data sources. I'd try a longer example CSV to get a better sense. One thing to test in that dataset would be how Calibre's concept of shelves maps to bookwyrm's, as well as reviews.

@Ryuno-Ki
Copy link
Contributor

Looked at the instruction @tastytea shared in the OP.
Here are the fields:

grafik

Importing my Smashing Magazine library yields this:

grafik

For example, I don't see reading status or review there.

@mouse-reeve
Copy link
Member

For the feature to be useful, I think it will need to add the books to a shelf - I'm not familiar with Calibre, so hopefully someone who uses it can be helpful here. It doesn't look like there's an analogous field in the CSV data (I may be missing something!), so the simplest solution would be to pick one of the standard shelves and have all the books end up on that shelf. A better solution would be to let the user decide which shelf the books end up on, which is a bit more of a complex coding challenge.

@Ryuno-Ki
Copy link
Contributor

Okay, here's my suggestion:

Make this issue about importing all books into a standard shelf as a first step.

Open another issue to make the user be able to select a different shelf (I see questions to answer here like „per book?”, „to a completely new shelf?”, „only for Calibre imports?”). Personally I discovered that I cannot copy/move a book into another shelf but have to go through the search again and add it again.

I go ahead and look into implementing the code accordingly. I can iterate on if you disagree with my proposal.

@tastytea
Copy link
Contributor Author

tastytea commented Apr 30, 2022

For the feature to be useful, I think it will need to add the books to a shelf - I'm not familiar with Calibre, so hopefully someone who uses it can be helpful here. It doesn't look like there's an analogous field in the CSV data (I may be missing something!),

As far as I'm aware Calibre does not have shelves. Books can be organised in libraries, but they can't be exported all at once, only one at a time. I guess most users will only have one library.

so the simplest solution would be to pick one of the standard shelves and have all the books end up on that shelf. A better solution would be to let the user decide which shelf the books end up on, which is a bit more of a complex coding challenge.

Maybe all books with a rating should go to the read shelf and the rest to a shelf called ‘imported books’ or something like that?

Edit: Ah, a rating does not necessarily mean the user rated it.

@Ryuno-Ki
Copy link
Contributor

Pushed my update. See #2093.

Do you want me to fill the above mentioned follow-up issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
books enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants