View Single Post
Old 03-18-2024, 10:31 AM   #1
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,770
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Options for summarizing the book list

I am considering submitting to @kovid a change to add a new search term to calibre: summarize_booklist:field_name,count, where 'field_name' is the lookup name and 'count' is optional.

This search term does the same thing as the template in this post. Specifically it scans the current book list in order, searching for values in "field_name". If the number of value(s) already seen is less than "count" then it adds the book to the search results.

Because it scans the book list in order, you have control over which value(s) it finds first by sorting the book list before doing the search. Because it uses the book list, subsequent "summarize_booklist" searches further summarize what you see. You get back to the "full" book list (subject to VLs) by erasing the "summarize_booklist" search.

Here is an example of summarizing the book list by series. The first capture shows several series on the book list, sorted by series.
Click image for larger version

Name:	Clipboard08.jpg
Views:	73
Size:	288.0 KB
ID:	206980

This capture shows the result of the "summarize_booklist:series,1" search:
Click image for larger version

Name:	Clipboard09.jpg
Views:	65
Size:	160.1 KB
ID:	206981

This capture shows the result if the book list was sorted series descending before the "summarize_booklist" above was applied.
Click image for larger version

Name:	Clipboard10.jpg
Views:	57
Size:	165.0 KB
ID:	206982

And finally, this capture shows the result of applying "summarize_booklistublisher,1" to the result of the previous summarize.
Click image for larger version

Name:	Clipboard11.jpg
Views:	59
Size:	131.6 KB
ID:	206983

It isn't clear that I should propose this code. The biggest issue is that it is similar in concept to making a pivot table, but there is no way (and never will be a way) to interactively open and close the sublists. In other words, there is no "button" to show the books in theory hidden behind the displayed book.

A second issue is that as mentioned above, the summarization is cumulative. To start over one must erase the current search, or do something like open a VL that does the same thing. This behavior is different from normal calibre searches, which start over each time, ignoring what is displayed. I can't repeat that behavior so there will be confusion, and therefore posts and bug reports.

Finally, this search term works only in the GUI. Using it from the command line or calibre server won't work.

Still thinking. Your thoughts are welcome.

Last edited by chaley; 03-18-2024 at 11:05 AM.
chaley is offline   Reply With Quote