03-13-2024, 12:27 PM | #16 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Exactly. I haven't used the 'and' connector in my posts because that's how I always do the searches, given they behave the same when 'and' is omitted
|
03-13-2024, 12:32 PM | #17 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
|
Advert | |
|
03-13-2024, 01:16 PM | #18 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
By the way, I find Calibre search amazing. It can even understand parentheses syntax, as in:
l:en (f:ep or f:az or f:mob) tag:non where l is my short search alias for languages, f is for formats. ep is my 'epub' lazy form |
03-13-2024, 02:37 PM | #19 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I may have confused things, but lets put that aside.
I have an implementation that doesn't require the temporary VL but respects the current VL. It is a bit more complicated because I wanted to generalize it to any field, not just authors. To use what I describe below you must be running calibre 7.7 or later. To use it, make a stored template named whatever you want -- I use "get_one_book_per_field_value". The template itself is: Spoiler:
This template takes one argument, the field (column) you are interested in (authors).
Next, make this template search: Code:
template:"""program: get_one_book_per_field_value('authors')#@#:b:yes""" You also need @Katja_hbg's A. To get it, put this in a stored template named what you want. I named it "item_has_notes". The template is Spoiler:
This template also takes 1 argument, the field (column) name. Now make another template search Code:
template:"""program: item_has_notes('authors')#@#:b:yes""" You can now do searches like:
All of this works for me. I hope it works for you. Last edited by chaley; 03-15-2024 at 07:52 PM. Reason: disabled smilies in text |
03-13-2024, 02:53 PM | #20 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Yes, that works perfectly! Also, surprisingly fast.
Running from source, I've just tested template:"""program: get_one_book_per_field_value('authors')#@#:b:yes"" " tag:fantasy template:"""program: get_one_book_per_field_value('authors')#@#:b:yes"" " tag:biography f:ep Both return only one title per author. edit to add: it works also on latest preview version, by the way! Last edited by Comfy.n; 03-13-2024 at 03:11 PM. |
Advert | |
|
03-13-2024, 04:51 PM | #21 | ||
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
In addition, in some cases it is possible for the get_one_book ... to select a book for an author that won't match the rest of the search expression. Were this to happen, the answer would be missing that author. For example, imagine that Joe Blogs has two titles, A and B. Title A is tagged "Historical Fiction". Title B is tagged "Science Fiction". The get_one_book ... algorithm could pick either book as the "one title". If you combine it with a tags:... clause then the tag might match the other book, resulting in neither book being found. This won't happen if get_one_book ... is the last expression in the search and you are using the latest source. Quote:
|
||
03-14-2024, 07:09 AM | #22 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The calibre change mentioned above is in release 7.7, released today.
|
03-15-2024, 08:01 PM | #23 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Inspired by this question, today I decided to use publisher instead of authors:
Code:
template:"""program: get_one_book_per_field_value('publisher')#@#:b:yes"""
In my mind, what followed was: what if I could display only like 5 or 10 titles per publisher? Then I would be able to see filtered in a library a list of the top voted books by publisher! Last edited by Comfy.n; 03-15-2024 at 08:39 PM. |
03-16-2024, 09:15 AM | #24 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Other templates I have already written are further variants. Example, show the last book in a series and show the first book in a series. At first blush I don't want to go here. However, I do have an idea that might work and be of general use -- iterate through the displayed books (the current book list) in order, showing N books per field. To use it, one would search for the books of interest and make a temp VL of that search. Then sort the booklist in the order you want the filtering. Then run the filter. This could do all of the above, but does take some thought and planning to make work. I need to think about this. |
|
03-16-2024, 10:33 AM | #25 |
Leftutti
Posts: 410
Karma: 1153449
Join Date: Feb 2019
Location: Bavaria
Device: iPad Pro, Kobo Libra 2
|
Unfortunately, the one in post #19 does not work for me.
Both templates already show the same error (Calibre 7.7) But my feeling tells me that the problem is in front of the computer. |
03-16-2024, 11:14 AM | #26 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You can also test the stored templates using the "Test" button in the Stored template dialog, but it isn't much of a test as it looks at only the currently selected books. For example, it you press the Test button and enter Code:
get_one_book_per_field_value('authors') |
|
03-16-2024, 01:42 PM | #27 |
Leftutti
Posts: 410
Karma: 1153449
Join Date: Feb 2019
Location: Bavaria
Device: iPad Pro, Kobo Libra 2
|
I have already tried that template searches
The same happens with Code:
template:"""program: get_one_book_per_field_value('authors')#@#:b:yes""" Last edited by Wiggo; 03-16-2024 at 01:51 PM. |
03-16-2024, 01:52 PM | #28 | |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Quote:
Last edited by Comfy.n; 03-16-2024 at 02:23 PM. |
|
03-16-2024, 01:54 PM | #29 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Here are my stored templates. They show up in the stored templates dialog, like this: This is my saved search, using the stored template: The names must be spelled exactly the same in the stored templates and the saved searches. |
|
03-16-2024, 02:01 PM | #30 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Books sent to Amazon show with my email as ther author | Robmonster | Calibre | 9 | 11-05-2020 01:17 PM |
Show Books from Only 1 Author | RiffRaffAK | Library Management | 2 | 06-04-2020 10:26 AM |
Expanded search option for "Show books by the same author as the current book" ALT+A | Sisela | Library Management | 1 | 11-28-2015 09:54 AM |
author search in book details panel | mobic | Library Management | 3 | 11-26-2015 10:50 AM |
To show author and author sort as same? | pinky62 | Library Management | 5 | 03-18-2014 12:55 PM |