05-07-2018, 11:48 AM | #1 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Feb 2014
Device: Kindle 4
|
Luanch Calibre with particular book selected
Is there a way to launch Calibre (from the command line) so that a particular book (which is already in the library) is selected? Or alternatively with a particular set of search results already displayed? Ideally the method should simply change the book selected (or search results displayed) if Calibre is already running. I do not want to trigger the add book routines as I know that the target book is already in my library when I want to do this.
Some context (for those interested): I'm on a Mac and I make use of BibDesk for citation purposes and would like to create a file link between a BibDesk entry and an ebook in Calibre. Obviously I cannot permit both programs to manage the actual location of a real file, so I'm creating Automator Apps which use a simple shell script to connect to the ebook. BibDesk can thus control the location of the Automator App while Calibre retains control over the ebook itself. Right now my Automator Apps launch the ebook-viewer directly, which requires the full path to the book (and thus is subject to breakage should Calibre ever move the book) and leaves me hanging when I need to do anything other than read the book (like say, edit it) because the reader has no links back to the main program (or to any of the other tools, like the editor). I thus would much prefer a way to launch the main Calibre program and have it point to the book. |
05-07-2018, 12:32 PM | #2 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
There's no way to open calibre pointing to a particular book, but you can get the full path to a book using the calibredb command line tool
calibredb list -f formats -s id:1234 See the entry for calibredb in the user manual for more details |
Advert | |
|
05-07-2018, 02:14 PM | #3 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Feb 2014
Device: Kindle 4
|
That doesn't work if calibre is already running: an error about the danger in having two programs which are capable of changing the database running at once is raised. I understand that having two programs changing the database at the same time is a problem, but a simple search to retrieve information from the database shouldn't change anything. Is there a way for the search functionality of `calibredb` (particularly the `list` and `search` tools) to be used while calibre is running?
|
05-07-2018, 02:54 PM | #4 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Feb 2014
Device: Kindle 4
|
Further question: If the book has multiple formats, is there a way to limit which format is retrieved?
|
05-07-2018, 09:58 PM | #5 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Turn on the calibre content server iin the calibre GUI and connect to that via calibredb, see the manual page for details.
No there's no way to limit which format is retrieved, but you can easily post process the returned list (use the --for-machine flag to has calibredb output the data in json format for easy processing). |
Advert | |
|
05-08-2018, 11:52 AM | #6 | |
Enthusiast
Posts: 40
Karma: 10
Join Date: Feb 2014
Device: Kindle 4
|
Quote:
Code:
$ calibredb list -f formats -s id:630 --for-machine --with-library "http://127.0.0.1:8080" [ { "formats": [ "AZW3", "HTMLZ" ], "id": 630 } ] |
|
05-08-2018, 12:20 PM | #7 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
I wouldn't be surprised if the path info was not returned because you are connecting to a server.
Sent from my Nexus 7 using Tapatalk |
05-08-2018, 01:35 PM | #8 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yeah the server wont get full path info as it has no concept of paths. But instead you can use calibredb export to copy the ebook file elsewhere and then launch it.
|
05-08-2018, 04:29 PM | #9 |
Enthusiast
Posts: 40
Karma: 10
Join Date: Feb 2014
Device: Kindle 4
|
Okay, I think I've managed to put everything together to get a satisfactory result.
For those interested, I'm creating an Application using Automator which runs the following shell script: Code:
book_search="#search string to find book#" PATH=/Applications/calibre.app/Contents/console.app/Contents/MacOS/:$PATH { book_id=$(calibredb search --limit 1 "$book_search") calibredb export --dont-save-cover --dont-update-metadata --dont-write-opf --formats azw3 --to-dir $TMPDIR --template "temp_book" $book_id } || { book_id=$(calibredb search --limit 1 --with-library "http://127.0.0.1:8080" "$book_search") calibredb export --with-library "http://127.0.0.1:8080" --dont-save-cover --dont-update-metadata --dont-write-opf --formats azw3 --to-dir $TMPDIR --template "temp_book" $book_id } open -a ebook-viewer "$TMPDIR/temp_book.azw3" It should also be noted, that even though the script is capable of handling both the case where the GUI is not open and the case where it is and the content server is running, it will fail if the GUI is open and the content server is not running. It is, therefore, recommended that you set you calibre preferences to start the content server automatically when the GUI is launched if you're going to do something similar. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
why only koreader can't be luanch in kual | potter.G | Kindle Developer's Corner | 6 | 06-08-2018 10:54 AM |
Book List showing more than Selected Author | Larla | Calibre | 3 | 08-13-2016 07:16 PM |
Previous selected book when opening Calibre | emoreau | Calibre | 3 | 07-27-2015 07:21 PM |
Selected a couple of Authors/Series but Calibre not showing the books selected | lizzyong | Library Management | 3 | 04-16-2015 07:47 PM |
I want Calibre 64bit to only show the tag selected | hola!claude | Library Management | 3 | 12-22-2014 05:14 AM |