GNOME Bugzilla – Bug 301800
Adding support for CBR/CBZ files
Last modified: 2006-01-12 14:54:43 UTC
I've wrote a patch to add a CBR/CBZ backend. CBR/CBZ files were created to archive comic books but can be used to store any document made up from multiple images.
Created attachment 45617 [details] [review] Source Code Here is the patch made against the 0.2.1 release
Created attachment 45618 [details] MIME info Here is the xml for the additional mime types which are needed, I added mine to my /usr/share/mime/packages/freedesktop.org.xml file (on Ubuntu) and ran update-mime-database but there is probably a better way for evince to install this
Thanks for writing patch. Have you tried to submit comic mimetype to shared-mime-info?
I have now, https://bugs.freedesktop.org/show_bug.cgi?id=3122
Was the addition of these formats discussed on the mailing list? If not I think it should...
Not yet. I made the suggestion in a desktop devel thread then accepted the challenge to implement it, see http://mail.gnome.org/archives/desktop-devel-list/2005-April/msg00177.html I'll send an email to the list.
Created attachment 45877 [details] [review] Another implementation I wrote the same thing about a week ago (so this is why we're supposed to mail the list before doing anything). The main differences are that it uses pipes instead of tempfiles and that the pixbufs aren't stored in the document object (this can be evil when viewing archives with 100+ high quality images), but extracts them on the fly instead. It also uses the rar/zip mimetypes, since shared-mime-info doesn't include cbr/cbz yet. For those interested in testing these patches, I put up a sample book in http://amnerika.ath.cx/sisu.cbr
It's a trade off, loading everything into memory takes longer to load at first but is smoother to use as it's not pausing to load each page, try in Continuous view with a much larger CBR file then scroll up and down between pages to see what I mean. However I prefer the load on demand approach as it will save on memory, maybe you could cache/preload a few pages before and after the current page as these are the most likely to be viewed next. Pipes are a much better approach and I would have done so myself if I knew how, my gnome/glib programming skills are limited :) I'm happy for this patch to be used instead of my own along with the MIME type changes.
Just tried it against latest CVS, it is indeed slow, especially while the thumbnails are still loading. Maybe preloading+caching 2 pages before and after would be satisfying. I'll whip up something like that when I'm not tired, probably tomorrow.
First of all, I think we should definitely rely on comic book mime type instead of archive type (), since bug to add comic book is assigned to jrb and he will also solve question about applying this patch. Definitely we should look to the future. Second, the second patch is a bit better, since it uses more glib-oriented functions like g_spawn_async instead of system that provide way for error- checking and look more familiar to gtk progammers. It would be nice to have update of first patch with such changes made. About on-the-fly vs on-start parsing. It's hard question about performance and one can see problems with such extraction in djvu backend also. There should be some workaround on backends makes hard calculation of page size and there should be work around long delay on document loading (it's bug 165413). But for current state of evince, it's better to extract all files in a time and work with them. So a mixture of first and second patch (extract on start + parsing pixbufs on the fly) would be optimal. And it would be nice to calculate page sizes on start and cache them in one process (currently evince quieries all sizes in the beginning, so that will improve a performance a bit). All above is just a start for discussion, not direct recomendations for implementations, probably maintainers of evince can say something different.
nsh do you know what's the status here?
Getting this off my radar :)
I am waiting for addition of mime type to shared-mime-info. After I am going to start work on update of a patch. Probably, next weekend.
The patch needs update, and that should be easy, marking it as gnome-love
Hey all. Teemu version was finally committed. Thanks to all developers, especially Paul, but second patch was more optimal, I think. I hope there will be more work on comics in evince and we'll make this format fully supported.
Note that the correspondings MIME types (CBR, CBZ) are now in shared-mime-info
Thanks, Olivier. Actually I have already removed custom mime types and now evince uses shared-mime-info descriptions.