02-23-2014, 05:32 PM | #1 |
Groupie
Posts: 155
Karma: 106422
Join Date: Nov 2010
Device: none
|
Calibredb export: can I do a subset of books (based on a query)?
I see in the calibredb page there is a way to either export all of the books or a single ID:
calibredb export [options] ids Does anyone have an example of how to export just a subset of books based on a search? For instance, I want to only export the Recipe books (author = 'calibre'). I'm assuming I would have to do a two step process and come up with a list of ids that match my query and then call 'calibredb export' one by one on those ids. Any thoughts on the easiest way to do this? Thanks. |
02-23-2014, 07:13 PM | #2 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
You use
Code:
calibredb list -s "search-term" -f "" Code:
calibredb export [options] Code:
calibredb list -s "search-term" -f "" | tail -n +2 | calibredb export [options] |
Advert | |
|
02-23-2014, 08:28 PM | #3 |
Groupie
Posts: 155
Karma: 106422
Join Date: Nov 2010
Device: none
|
That sounds about what I thought would be needed. Should be able to pound out a powershell script to do similar...
Thanks for the response... |
02-25-2014, 11:12 AM | #4 |
Groupie
Posts: 155
Karma: 106422
Join Date: Nov 2010
Device: none
|
Hi eschwartz,
Quick question: when I do a -f with an empty string (-f "") I get an error on Windows that says a blank string is not acceptable. Do you get the same error on unix? I can probably work around it and just use "uuid" and parse each line somehow to get the ID... but it would be much nicer if I could just get a list of IDs with the command... |
02-25-2014, 02:27 PM | #5 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
No I get a list of ids, one per line. calibredb list always gives you the ids field, plus the -f "fields".
Code:
-f FIELDS, --fields=FIELDS The fields to display when listing books in the database. Should be a comma separated list of fields. Available fields: *annotations,*asin,*file,*filesave,* subseries,*subseries_index,*titlesave,author_sort,auth ors,comments,cover,formats,identifiers,isbn,last_modif ied,pubdate,publisher,rating,series,series_index,size, tags,timestamp,title,uuid Default: title,authors. The special field "all" can be used to select all fields. Only has effect in the text output format. So passing the empty string I used to clear the default fields, but I have no idea why it's erroring for you. .... Found it! It's a Windows problem, not calibre. Apparently powershell doesn't like empty strings, see here for how to deal with it: http://stackoverflow.com/questions/1...ing-powershell |
Advert | |
|
02-25-2014, 03:01 PM | #6 |
Groupie
Posts: 155
Karma: 106422
Join Date: Nov 2010
Device: none
|
Wow, that's pretty hard-core on the powershell thing. I would have assumed it was a bug with calibredb on windows vs. linux. Nice find.
Putting the double quotes inside of single quotes (or single ticks as someone used to call them) worked fine: '""' Good find! |
02-25-2014, 03:18 PM | #7 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I just googled "windows pass the empty string as parameter" but I'll take the compliment anyway.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Select books based on info from Conversion > Export Catalog | halfcore | Library Management | 2 | 10-22-2013 06:15 PM |
Need help with adding books via calibredb | Benji99 | Calibre | 1 | 03-17-2012 12:31 PM |
Can Excel SQL query get metadata out of calibredb? | unboggling | Calibre | 24 | 01-20-2011 02:45 AM |
Query about 2 books by Ken Follett | lene1949 | General Discussions | 4 | 10-15-2010 08:05 AM |
how do I export my Kobo books | Zepherious | Kobo Reader | 4 | 05-29-2010 02:43 PM |