We live in a cruel and frustrating universe, full of situations where we're forced to choose which of two imperfect options we're willing to settle for.
Case in point: comicthumb
is so much faster than evince-thumbnailer
, the default thumbnailer used for .cbr and .cbz files in most standard Gnome installations. It's not even funny. But, comicthumb
only thumbnails local files, whereas evince-thumbnailer
can thumbnail files located on network shares as well. It's quite the conundrum.
Conund no longer, comics fans! Frustrated with this situation, and wanting to take advantage of comicthumb's speed, I decided to hack in remote-file support via Gio.
The attached patch 0002 adds a dependency on the python gio module (in Fedora, part of the pygobject2 package), but in return it enhances comicthumb to accept any valid Gio URI as its first argument.
This is done by using the gio.File.get_path()
method to generate a local filesystem path to the remote file, using the remote mount's gvfs mountpoint. (On my system, that's a path starting with /run/user/$UID/gvfs/<remote_mount>
.) That path is then passed to the thumbnailing function, which doesn't have to know how to speak Gio or deal with anything involving remote files or URI schemes. As such, it requires a Gvfs mount, you still can't thumbnail random arbitrarty HTTP URLs or whatever.
file:///
URIs will work same as before, but now so should ftp:
,sftp:
, smb:
, dav:
, and any other Gvfs-mountable type, although I've only personally tested with sftp://
URIs. (Bare file paths, without a URI scheme, will also still work normally.)
In my testing, thumbnailing .cbz
and .cbr
files on my local LAN fileserver via sftp://
mount takes between ~1.2 and 2.0 seconds with comicthumb
, if the files are in the 25MB - 80MB size range currently typical for a single issue of a comic book. evince-thumbnailer
takes between 5.5 and 7 seconds to generate the same thumbnail.
Larger files take slightly longer, but the growth is much less steep than with evince-thumbnailer
: A 181-page TPB I have, with a file size of just over 350MB, takes comicthumb
up to 3 seconds to thumbnail on the remote filesystem. The same operation takes evince-thumbnailer
anywhere from 25 to 28 seconds!
The 0001 patch adds application/vnd.comicbook+zip
to the MimeTypes
entry in the thumbnailer file, as that's the type returned for .cbz
files in recent versions of Fedora.
Hmm. It seems I can't edit the ticket text after-the-fact, and since that typo is going to bug me, for the record:
s/arbitrarty/arbitrary/
This should be closed, (if for no other reason than...) the patches in question are no longer valid with
gi.repository.Gio
.