View Single Post
Old 10-12-2013, 03:43 AM   #14
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kcz View Post
Wow, this is truly an excellent idea. I totally forgot about the command line interface.
In this case I can write a script in perl, bash or whatnot and run the script every time I modify a series.
And some day if/when you have time, you could do it in python as a standalone calibre script (calibre-debug -e), using calibre's data layer. This would run *many* times faster because a) it would be one execution instead of one per book, b) it could check if anything had changed, and c) could update all the books in a series in one transaction. The program would do something like:
1) iterate through all the book ids in the db (there is a method for that), building a map of series -> desired number format and series -> existing number format.
2) iterate through the maps. If desired != existing:
2.1) use the db-level search method to get all ids for a series.
2.2) use the db-level update field multiple to set the custom column for all the books in the series to the "desired" value.
Quote:

Thank you so much. I guess I didn't see the forrest for the trees.

You are welcome. It has been an interesting discussion.
chaley is offline   Reply With Quote