View Single Post
Old 05-09-2015, 06:12 AM   #3
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: 12,457
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
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