Menu

#49 comicthumb: Thumbnail remote file URIs using Gio

SVN
closed-invalid
nobody
None
5
2023-03-12
2017-09-18
FeRD
No

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.

The Problem

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.

A Wild SOLUTION Appears!

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.

Details, Details

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.)

Yeah, But What Can It Do?

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-thumbnailertakes 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!

One More Thing

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.

2 Attachments

Discussion

  • FeRD

    FeRD - 2017-09-18

    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/

     
  • FeRD

    FeRD - 2023-03-12

    This should be closed, (if for no other reason than...) the patches in question are no longer valid with gi.repository.Gio.

     
  • Oddegamra

    Oddegamra - 2023-03-12
    • status: open --> closed-invalid
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.