Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 05-19-2024, 03:59 PM   #1
Trel
Connoisseur
Trel began at the beginning.
 
Posts: 62
Karma: 10
Join Date: Jan 2010
Device: Onyx Boox Poke 3
What would be the best/correct way do query for

I have a custom read/unread column.
I'm aware of calibredb, but not very familiar with it.

What I tried to do was

Code:
calibredb --library-path=/path/to/library list --fields "series,series_index" --search 'series:True series_index:1.0 #readstatus:"=Read"' --sort-by 'series'
I got it mostly working, but three issues.

1. The sort is reverse alphabetical (I want alphabetical)
2. The sort is done where "insignificant" words like "A" or "The" are disregarded (I want them included)
3. It still prints the ID, despite me not including it in --fields (I don't want the ID shown).

I was able to handle this with a mixture of various Linux text processing tools like cut, sed, and sort, but ideally I wouldn't have to do this somehow?

Once I get that down, I want to additionally select the MAX series index for each series, but I have no clue how I'd do that.

Last edited by Trel; 05-19-2024 at 04:03 PM.
Trel is offline   Reply With Quote
Old 05-19-2024, 08:36 PM   #2
jmurphy
Connoisseur
jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.
 
Posts: 95
Karma: 1133068
Join Date: Sep 2007
Device: ipaq
It won't get rid of the id, but try:

list --fields series,series_index --search "series:true and series_index:1.0 and #readstatus:Read" --sort-by series --ascending
jmurphy is offline   Reply With Quote
Advert
Old 05-20-2024, 04:05 PM   #3
Trel
Connoisseur
Trel began at the beginning.
 
Posts: 62
Karma: 10
Join Date: Jan 2010
Device: Onyx Boox Poke 3
Quote:
Originally Posted by jmurphy View Post
It won't get rid of the id, but try:

list --fields series,series_index --search "series:true and series_index:1.0 and #readstatus:Read" --sort-by series --ascending

That addresses the reverse sort, but it also breaks filtering on readstatus because "read" matches "read" and "unread", it's gotta be "=Read". It unfortunately doesn't help the issue with 'a' and 'the' not getting sorted alphabetically either.
Trel is offline   Reply With Quote
Old 05-20-2024, 10:29 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,963
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you want to sort including leading articles create a custom column in the library that uses a template to generate the value of series. It will sort using the value as a simple string.
kovidgoyal is online now   Reply With Quote
Old 05-21-2024, 12:28 PM   #5
jmurphy
Connoisseur
jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.
 
Posts: 95
Karma: 1133068
Join Date: Sep 2007
Device: ipaq
Quote:
Originally Posted by kovidgoyal View Post
If you want to sort including leading articles create a custom column in the library that uses a template to generate the value of series. It will sort using the value as a simple string.

Maybe a built-in Series Sort field similar to Author Sort and Title Sort would make sense and then allowing the user to sort by either the literal field or the sort field.

Is there any way to suppress the output of the id field?
jmurphy is offline   Reply With Quote
Advert
Old 05-21-2024, 12:52 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,963
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by jmurphy View Post
Maybe a built-in Series Sort field similar to Author Sort and Title Sort would make sense and then allowing the user to sort by either the literal field or the sort field.

Is there any way to suppress the output of the id field?
Too much UI overhead for a niche use case.

And no you cannot suppress ids without them you can get duplicate rows. If you want full control use --for-machine which will output json and then postp process however you like using a tool such as jq or similar.
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query re editor johngross Editor 0 10-07-2019 04:46 PM
meaning and how to correct ralphiedee Sigil 4 10-17-2012 03:48 PM
Metadata query iain robinson ePub 4 08-08-2012 12:07 PM
Hello and query MPDuke Introduce Yourself 8 12-13-2011 10:27 AM
Query - Kindle DX US ukhant Kindle Developer's Corner 2 07-20-2010 03:23 AM


All times are GMT -4. The time now is 09:33 PM.


MobileRead.com is a privately owned, operated and funded community.