Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 05-09-2015, 05:57 AM   #1
wladdy
Enthusiast
wladdy began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Oct 2010
Device: iPad / Kindle DX
Getting IDs of books selected in the GUI

Is there a direct way to get through the CLI the IDs of the books currently selected in the GUI?

Today, my workaround involves a custom Yes/No column whose lookup name is "current". In the GUI, I set to "Yes" the value for that column of the selected files. Then, running the following command in the CLI returns the IDs that I want:

Code:
calibredb list -w 1000 -s '#current:"Yes"' | sed -n 's_^\([[:digit:]]\+\) .*_\1_p'
This method works well enough, but requires the hassle of dealing with a dummy custom column. I'd be grateful to anyone suggesting a better, more direct approach.

Many thanks! W.
wladdy is offline   Reply With Quote
Old 05-09-2015, 06:12 AM   #2
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: 33,501
Karma: 10205098
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, there's no way to query the state of the GUI from the CLI. You could if you wish write a GUI plugin that exposes whatever state you like via a socket, but there is no builtin way to do that.
kovidgoyal is offline   Reply With Quote
Advert
Old 05-09-2015, 06:12 AM   #3
chaley
CC Android & calibre dev
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: 8,756
Karma: 2655962
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by wladdy View Post
Is there a direct way to get through the CLI the IDs of the books currently selected in the GUI?

Today, my workaround involves a custom Yes/No column whose lookup name is "current". In the GUI, I set to "Yes" the value for that column of the selected files. Then, running the following command in the CLI returns the IDs that I want:

Code:
calibredb list -w 1000 -s '#current:"Yes"' | sed -n 's_^\([[:digit:]]\+\) .*_\1_p'
This method works well enough, but requires the hassle of dealing with a dummy custom column. I'd be grateful to anyone suggesting a better, more direct approach.

Many thanks! W.
If I understand you correctly, you want to select some books in the GUI then run some CLI command on those books. There isn't any way to do this. The CLI doesn't know that the GUI is running, much less have any access to the state of the GUI.

A GUI plugin can see the selection and do almost arbitrary things with it. For example, you might be able to modify the open-with plugin to run cli commands on books.
chaley is offline   Reply With Quote
Old 05-09-2015, 06:23 AM   #4
wladdy
Enthusiast
wladdy began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Oct 2010
Device: iPad / Kindle DX
Thank you for the prompt replies, I'll just keep using my workaround - Kovid's suggestion is way beyond my skill level!

A good week-end to all and, to Kovid, my wishes of full recovery! W.
wladdy is offline   Reply With Quote
Reply

Tags
calibredb, cli, gui, selected, selection

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Selected a couple of Authors/Series but Calibre not showing the books selected lizzyong Library Management 3 04-16-2015 07:47 PM
Added files to selected books Tanjamuse Calibre Companion 3 01-25-2015 08:47 AM
set selected books to same title mohataj Library Management 6 12-23-2014 05:40 PM
Move selected books to other library macnab69 Library Management 27 06-29-2013 10:35 PM
30% off selected books from Kobo Store melchizedek Deals and Resources (No Self-Promotion or Affiliate Links) 5 05-06-2012 10:04 AM


All times are GMT -4. The time now is 03:47 PM.


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