View Full Version : Mac/OSX Quicklook Plug-In for ePub


kbullkar
01-21-2012, 08:46 AM
I hoping there is an easy answer for this, but couldn't find it...

I have an issue with two QL plugins interacting... BetterZipQL.qlgenerator and epub.qlgenerator.

When BetterZipQL is loaded, it wants to be the one displaying the epub, which would be OK if it would use the cover.jpeg as the logo, but as it is, it just uses a generic "epub" image... anyone know a way to either change the behavior of BetterZipQL to display the cover.jpeg for epub's or to have epub used for epub's even when BetterZipQL is loaded?

MacBook-Pro:Stephanie Plum 1-16 (epub) Keith$ qlmanage -r
qlmanage: resetting quicklookd
MacBook-Pro:Stephanie Plum 1-16 (epub) Keith$ qlmanage -d 1 -p \#2\ Two\ for\ the\ Dough\ -\ Janet\ Evanovich.epub
Testing Quick Look preview with files:
#2 Two for the Dough - Janet Evanovich.epub
[DEBUG] Registering <QLGenerator Built-in 0x100128410> for public.image
[DEBUG] Preview test for #2 Two for the Dough - Janet Evanovich.epub -- /Users/Keith/Ebooks to Process/Stephanie Plum 1-16 (epub)/. Content type UTI: com.macitbetter.zip-archive
[DEBUG] Previewing /Users/Keith/Ebooks to Process/Stephanie Plum 1-16 (epub)/#2 Two for the Dough - Janet Evanovich.epub. Content type UTI: com.macitbetter.zip-archive. Generator used: <QLGenerator /Library/QuickLook/BetterZipQL.qlgenerator>
[DEBUG] Loading <QLGenerator /Library/QuickLook/BetterZipQL.qlgenerator>
[WARNING] Plug-in at /Library/QuickLook/BetterZipQL.qlgenerator/ is 32bit
[DEBUG] Will execute <QLGenerator /Library/QuickLook/BetterZipQL.qlgenerator> in 32bit process
[DEBUG] Preview test for /Users/Keith/Ebooks to Process/Stephanie Plum 1-16 (epub)/#2 Two for the Dough - Janet Evanovich.epub. Content type UTI: com.macitbetter.zip-archive
[DEBUG] Previewing /Users/Keith/Ebooks to Process/Stephanie Plum 1-16 (epub)/#2 Two for the Dough - Janet Evanovich.epub finished

(removed BetterZipQL.qlgenerator)

MacBook-Pro:Stephanie Plum 1-16 (epub) Keith$ qlmanage -r
qlmanage: resetting quicklookd
MacBook-Pro:Stephanie Plum 1-16 (epub) Keith$ qlmanage -d 1 -p \#2\ Two\ for\ the\ Dough\ -\ Janet\ Evanovich.epub
Testing Quick Look preview with files:
#2 Two for the Dough - Janet Evanovich.epub
[DEBUG] Registering <QLGenerator Built-in 0x100324c70> for public.image
[DEBUG] Preview test for #2 Two for the Dough - Janet Evanovich.epub -- /Users/Keith/Ebooks to Process/Stephanie Plum 1-16 (epub)/. Content type UTI: org.idpf.epub-container
[DEBUG] Previewing /Users/Keith/Ebooks to Process/Stephanie Plum 1-16 (epub)/#2 Two for the Dough - Janet Evanovich.epub. Content type UTI: org.idpf.epub-container. Generator used: <QLGenerator /Library/QuickLook/epub.qlgenerator>
[DEBUG] Loading <QLGenerator /Library/QuickLook/epub.qlgenerator>
[DEBUG] Previewing /Users/Keith/Ebooks to Process/Stephanie Plum 1-16 (epub)/#2 Two for the Dough - Janet Evanovich.epub finished[/SIZE][/FONT]

chrisridd
01-22-2012, 03:32 AM
It works OK for me in Lion with the current version of that epub.qlgenerator installed and BetterZIPQL.qlgenerator 1.2 installed.

What version of OS X are you using and what version of epub.qlgenerator are you using?

It looks like https://github.com/jaketmp/ePub-quicklook/downloads added a new version for Lion, and maybe it isn't completely compatible with older OS Xes? One change is that Lion introduced a UTI for epubs which that epub.qlgenerator had to then also use - UTIs are how Quicklook decide what generator to use so it is important that these all "match up".

(UTIs are used by lots of other apps too, they're not QuickLook specific.)

kbullkar
01-27-2012, 08:53 PM
I am on Snow Leopard.

Can you run qlmanage in debug mode and let me know what it lists for the UTI (e.g. "Content type UTI: org.idpf.epub-container.") - I will try adding it manually.

chrisridd
01-28-2012, 11:15 AM
I am on Snow Leopard.

Can you run qlmanage in debug mode and let me know what it lists for the UTI (e.g. "Content type UTI: org.idpf.epub-container.") - I will try adding it manually.

The UTI reported by Lion is indeed "org.idpf.epub-container", and that's the one the current version of Jake's epub.qlgenerator generates previews for.

I think I see the problem. The BetterZip Quicklook plugin explicitly matches files with an "epub" file extension, and on Snow Leopard that gets used instead of the UTI, as Snow Leopard does not declare that proper epub UTI.

I don't know if you can add the correct UTI anywhere - if you figure out how, please reply here. I'm currently helping Jake update his qlgenerator and maybe there's something it can do better.

I've found a way to get around this by patching BetterZip though:

1. Move the BetterZipQL.qlgenerator file to your desktop. Run qlmanage -r to make OS X forget about it.

2. Open the Contents/Info.plist file inside the BetterZipQL.qlgenerator package using a text editor.

3. Find the single line in the file that looks like:

<string>epub</string>

Delete that line. Save the Info.plist file.

4. Move the BetterZipQL.qlgenerator file back to /Library/QuickLook. Run qlmanage -r again.


Another workaround is to rename "epub.qlgenerator" so it is alphabetically before "BetterZip", e.g. "aaepub.qlgenerator".

HowardBrazee
02-18-2012, 01:04 PM
I've installed http://legacy.audacious-software.com/weblog/2009/09/codex-plugins-1-0b1/, but haven't been able to get Spotlight to see my Calibre .epubs.

chrisridd
02-20-2012, 03:33 AM
I've installed http://legacy.audacious-software.com/weblog/2009/09/codex-plugins-1-0b1/, but haven't been able to get Spotlight to see my Calibre .epubs.

The Codex plugins need to be updated to work correctly on OS X Lion - on Lion the system identifies files with an epub extension as "org.idpf.epub-container", and unless plugins use the same type they won't work.

Codex uses "com.audacious-software.codex.epub" instead, so will not work on Lion. Have you asked the Codex author to update them?

NB the author of the Lion-friendly Quicklook plugin mentioned earlier in the thread is adding a Spotlight importer. It isn't ready yet, but it is worth keeping an eye on his github page.

chrisridd
02-22-2012, 01:32 PM
Note there is a new release of the Quicklook generator available today at https://github.com/jaketmp/ePub-quicklook. Check the README (that page) and follow the Downloads link to get the new release.

If you find problems and have a github account, please raise an Issue on that web page. If you find problems and don't - post them here instead and I will raise them myself.

Jake and I are making good progress on the Spotlight importer, which is part of that project. Hopefully we can make a release of it soon.

HowardBrazee
02-24-2012, 01:16 PM
That page has lots of files to download that I don't understand. Instructions say:
Place the ePub.qlgenerator file into /Library/QuickLook (for all users) or ~/Library/QuickLook (for the current user only).

But I'm not finding a file by that name.

chrisridd
02-24-2012, 02:56 PM
That page has lots of files to download that I don't understand. Instructions say:
Place the ePub.qlgenerator file into /Library/QuickLook (for all users) or ~/Library/QuickLook (for the current user only).

But I'm not finding a file by that name.

Download this zip file (https://github.com/downloads/jaketmp/ePub-quicklook/epub.qlgenerator.zip). Double-click it to extract the Quicklook generator - it'll be a Lego-brick shaped icon called "epub.qlgenerator" or just "epub" if you have configured Finder to hide file extensions.

Select the file icon and click Edit>Copy.

Now click Go>Go to folder...

A sheet will drop down saying "Go to the folder:"

Type in (without the quotes) "/Library/QuickLook/" and click Go.

If that succeeds, it'll show the folder containing other installed Quicklook plugins. Click Edit>Paste.

You may get prompted for an administrator name and password. Enter them.

That should have installed the plugin. As the README says, there are a couple of ways to make the Mac start using it - logging out and in is simple. Rebooting is another option. The last option is to open Terminal.app and type in:

qlmanage -r

and hit return. (That's what I do.) That will tell 'quicklookd' to rescan all the Quicklook folders for new plugins.

HowardBrazee
02-25-2012, 10:59 AM
I just did the above (except reboot). My suffixes do display, and I did have to type in my administrator name and password. I tested with a name that's in a .rtf and .epub in the same directory. It still found the .rtf.

So I went into the spotlight privacy settings and excluded this file and tested (no change), then went back in and unexcluded it. (no change)

I'll reboot later this morning.

chrisridd
02-25-2012, 02:38 PM
I just did the above (except reboot). My suffixes do display, and I did have to type in my administrator name and password. I tested with a name that's in a .rtf and .epub in the same directory. It still found the .rtf.

So I went into the spotlight privacy settings and excluded this file and tested (no change), then went back in and unexcluded it. (no change)

I'll reboot later this morning.

It is a Quicklook plugin, not a Spotlight plugin. If you select an epub file in Finder and press space, Quicklook will display something hopefully useful (see attached). It will also change the Finder preview to the book's cover - see the right hand side of the attached image.

Jake and I are working on a Spotlight plugin. It is not complete yet!

HowardBrazee
02-26-2012, 09:58 AM
I misunderstood. I'm looking forward to your Spotlight plugin, that's what will be useful for me. If you announce it here, I will be notified.

Thanks

chrisridd
03-12-2012, 04:55 PM
I misunderstood. I'm looking forward to your Spotlight plugin, that's what will be useful for me. If you announce it here, I will be notified.

Thanks

The Spotlight plugin is released! Also, a new version of the Quicklook plugin. The README file is on this page:

https://github.com/jaketmp/ePub-quicklook

The download files are on this page:

https://github.com/jaketmp/ePub-quicklook/downloads

You just need the v1.5 file.

HowardBrazee
03-21-2012, 10:17 AM
Thanks. I hope I installed it correctly, I'll test it out later today.

HowardBrazee
03-21-2012, 10:12 PM
Thanks. I hope I installed it correctly, I'll test it out later today.

Rebooting didn't help, so I tried the mdimport. I suspect I need to make it a SUDO command, as my ID doesn't have administrator privilege. I think I installed it correctly to the system libraries.

Last login: Wed Mar 21 18:05:25 on console
Kernel Information: Darwin 11.3.0 x86_64
\e[0;33mGNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
Copyright (C) 2007 Free Software Foundation, Inc.
\e[1;30mUptime: 19:03 up 1 hr, 2 users, load averages: 0.68 0.52 0.61
\e[1;30mServer time is: Wed Mar 21 19:03:46 MDT 2012
~ > mdimport -r ~/Library/Spotlight/epub.mdimporter
2012-03-21 19:03:58.240 mdimport[1418:707] could not find path '/Users/HBrazee/Library/Spotlight/epub.mdimporter'
Usage: -o path Write the imported attributes to a file, instead of sending them to the server.
[OPTION] path
-d debugLevel Integer between 1-4
-g plugin Import files using the listed plugin, rather than the system installed plugins.
-p Print out performance information gathered during the run
-A Print out the list of all of the attributes and exit
-X Print out the schema file and exit
-L Print out the List of plugins that we are going to use and exit
-r Ask the server to reimport files for UTIs claimed by the listed plugin.
-n Don't send the imported attributes to the data store.
~ >

chrisridd
03-22-2012, 05:07 AM
Rebooting didn't help, so I tried the mdimport. I suspect I need to make it a SUDO command, as my ID doesn't have administrator privilege. I think I installed it correctly to the system libraries.

Last login: Wed Mar 21 18:05:25 on console
Kernel Information: Darwin 11.3.0 x86_64
\e[0;33mGNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
Copyright (C) 2007 Free Software Foundation, Inc.
\e[1;30mUptime: 19:03 up 1 hr, 2 users, load averages: 0.68 0.52 0.61
\e[1;30mServer time is: Wed Mar 21 19:03:46 MDT 2012
~ > mdimport -r ~/Library/Spotlight/epub.mdimporter
2012-03-21 19:03:58.240 mdimport[1418:707] could not find path '/Users/HBrazee/Library/Spotlight/epub.mdimporter'
Usage: -o path Write the imported attributes to a file, instead of sending them to the server.
[OPTION] path
-d debugLevel Integer between 1-4
-g plugin Import files using the listed plugin, rather than the system installed plugins.
-p Print out performance information gathered during the run
-A Print out the list of all of the attributes and exit
-X Print out the schema file and exit
-L Print out the List of plugins that we are going to use and exit
-r Ask the server to reimport files for UTIs claimed by the listed plugin.
-n Don't send the imported attributes to the data store.
~ >

It sounds like you installed it in /Library/Spotlight instead (the DMG has a link to that folder) so you should run this command instead:

mdimport -r /Library/Spotlight/epub.mdimporter

Assuming that doesn't immediately give you an error, your Mac will start indexing files in the background. If you run Activity Monitor you should see "mds" and perhaps "mdworker" working hard.

HowardBrazee
03-23-2012, 06:13 PM
That did the job. That command did not produce any feedback in Terminal, but a few hours later I tested, and it worked. Thanks.

I haven't checked your documentation to see if this command is there. This will be very useful to me. I'll want to create an epub version of any book I have - and bookmark your sites in case I ever upgrade my computer.

Thanks again.

chrisridd
03-29-2012, 09:16 AM
Great to hear!

Another feature of the spotlight plugin is that if you do a "Get Info" on an epub file in the Finder, the "More Info" section shows a couple of fields like the author and publisher.