Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 04-04-2025, 08:07 PM   #1
abe
Enthusiast
abe began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Mar 2025
Device: kobo libra 2
macOS quicklook plugin to view file using spacebar/singletap

just a feature suggestion, it would be nice if calibre implemented an epub file preview using quicklook extensions on macOS.

currently there's no way to see a book without opening it, and there are no available quicklook plugins for epub in the EU
abe is offline   Reply With Quote
Old 04-05-2025, 01:44 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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
waaaaaaaaay too much work for an OS specific feature, at least for me. Though if someone is interested in building one that works with calibre, it would likely be doable by using the apple provided WKWebView to render HTML. The HTML would be extracted using

Code:
calibre-debug -c "from calibre.ebooks.oeb.iterator.book import extract_book; import sys; print(extract_book(sys.argv[-2], sys.argv[-1])[1])" /path/to/ebook/file /path/to/outputdir
Running that command will extract the book as HTML into outputdir and print out the path to the OPF file that lists all the HTML files resulting from the book. It should be trivial to parse the OPF and get the list of HTML files to display.

Whether this is fast enough for quicklook, is debatable though. You could improve its performance by writing a python script that runs a daemon to service requests avoiding the startup cost of running calibre-debug. The script can be run directly as

calibre-debug /path/to/script.py

then the script can listen for requests on STDIN or a socket and run extract_book and write the OPF path to STDOUT or the socket.
kovidgoyal is offline   Reply With Quote
Advert
Old 04-05-2025, 02:00 AM   #3
abe
Enthusiast
abe began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Mar 2025
Device: kobo libra 2
Quote:
Originally Posted by kovidgoyal View Post
waaaaaaaaay too much work for an OS specific feature, at least for me. Though if someone is interested in building one that works with calibre, it would likely be doable by using the apple provided WKWebView to render HTML. The HTML would be extracted using

Code:
calibre-debug -c "from calibre.ebooks.oeb.iterator.book import extract_book; import sys; print(extract_book(sys.argv[-2], sys.argv[-1])[1])" /path/to/ebook/file /path/to/outputdir
Running that command will extract the book as HTML into outputdir and print out the path to the OPF file that lists all the HTML files resulting from the book. It should be trivial to parse the OPF and get the list of HTML files to display.

Whether this is fast enough for quicklook, is debatable though. You could improve its performance by writing a python script that runs a daemon to service requests avoiding the startup cost of running calibre-debug. The script can be run directly as

calibre-debug /path/to/script.py

then the script can listen for requests on STDIN or a socket and run extract_book and write the OPF path to STDOUT or the socket.
Ahah yeah I totally understand that . Thanks again for your beautiful work , calibre can already do so much
abe is offline   Reply With Quote
Old 04-05-2025, 03:13 AM   #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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
And since I was here, I have created a simple server for quicklook plugin integration. With this, creating a quicklook plugin leveraging calibre should be a weekend project for someone familiar with Cocoa.

https://github.com/kovidgoyal/calibr...0919840a3e5f06
kovidgoyal is offline   Reply With Quote
Old 04-05-2025, 03:21 AM   #5
abe
Enthusiast
abe began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Mar 2025
Device: kobo libra 2
Quote:
Originally Posted by kovidgoyal View Post
And since I was here, I have created a simple server for quicklook plugin integration. With this, creating a quicklook plugin leveraging calibre should be a weekend project for someone familiar with Cocoa.

https://github.com/kovidgoyal/calibr...0919840a3e5f06
Really awesome wow ! I just wouldn't know where to find a dev that knows about that
abe is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre Crashing: macOS while Customizing Plugin JVGen Calibre 10 01-23-2023 03:54 PM
Updating plugin fails because plugin file is in use by Calibre? ownedbycats Calibre 1 12-03-2022 08:34 PM
Remember category browser view [macOS] tlf Calibre 7 05-17-2022 07:05 PM
Replacing books messes with MacOS file system MarjaE Calibre 2 06-27-2018 09:22 PM
FIX4 - calibre ebook-view error in macos high sierra blisshome Calibre 4 12-15-2017 03:56 PM


All times are GMT -4. The time now is 02:27 PM.


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