Mobileread
Preferred formats in calibredb export
#1  halloleo 03-30-2020, 02:38 AM
I use calibredb export to create a flat copy of all my books in a Cloud location. I don't want to export all formats, only one format of each book. Some books come in PDFs, some in ePUBS, some in both.

With the --formats option I can restrict to say, only PDFs only, but then I won't get the books which are ePUBs only and vice versa. So how can I tell calibredb export to use the ePUB if it exits, but other formats, if an ePUB cannot be found? I'm thinking of something like Preferred formats...

My current way is to export all formats and then delete the duplicate formats via a script. - Not particularly efficient...
Reply 

#2  kovidgoyal 03-30-2020, 02:48 AM
In your script first query the database to find what formats are available for the book, then export it accordingly
Reply 

#3  halloleo 03-30-2020, 03:19 AM
Thanks for the reply!

So I have query calibredb for each book individually?

First get all book IDs, then query each for the formats, then export that format for this book? - This will be a lot of calibredb calls...

Or don't I understand this correctly?
Reply 

#4  kovidgoyal 03-30-2020, 03:24 AM
calibredb list -f formats
calibredb export
calibredb export
Reply 

Today's Posts | Search this Thread | Login | Register