Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: load images from archives without manual extract #672

Open
bobrofon opened this issue Sep 10, 2022 · 7 comments
Open

Feature: load images from archives without manual extract #672

bobrofon opened this issue Sep 10, 2022 · 7 comments

Comments

@bobrofon
Copy link

Hi, all.

In my day-to-day activities I sometimes work with archives of images (e.g., scans of documents, images inside backups). And I implemented a feature to work with archived images from feh without manually extracting them. I wonder if it may be useful to have this feature upstream.

The implementation is similar to cURL integration, but instead of the libcurl library, the libarchive library is used. You can check it out here: https://github.com/bobrofon/feh/tree/libarchive.

The performance with tar.gz-like archives is expectedly awful, and it's reasonable to hide archive support under an option, but with zip and rar archives it works pretty well. As a bonus, archive support makes it able to read .CBR/.CBZ/.CB7/.CBT (Comic Book Archive) file formats using feh, because they are basically archives of images.

The libarchive source code is published under the 2-clause BSD license mostly, and as I understand it, it should be compatible with feh.

What do you think about this feature? Would it be worth it to merge it into the main project?

@bobrofon
Copy link
Author

Similar suggestion here: #657.

@avlec
Copy link
Contributor

avlec commented Dec 1, 2022

Wouldn't it be possible to just have an open archive wrapper around feh that decompresses the images and pipes them to feh's stdin?

@bobrofon
Copy link
Author

bobrofon commented Dec 1, 2022

Wrapper approach should work for a single file. But I don't really understand how to do something like this with multi-file archives. Well, I can extract a single file and pipe it to feh, but I cannot make a slideshow from the files, or save them as a part of a file list.

@avlec
Copy link
Contributor

avlec commented Dec 2, 2022

Could in the case of requiring multiple images to be loaded to create a temporary directory in /tmp or /var/tmp and extract the files there and then load that directory into feh and delete it when done or hope that your OS deletes it on reboot.

It is just going to be a lot more challenging to support decompression within feh, when a few line shell script can solve the issue. I have had this PR (#594) up for over a year now and it probably won't get in for the same reason

@bobrofon
Copy link
Author

bobrofon commented Dec 2, 2022

Well, yes. It is possible to unpack an archive into /tmp directory. But if I want to use this approach recursively (like feh --recursive but also search for images inside archives), it becomes a little more complex than a few lines of shell script. Also, this approach is not so useful with feh --filelist, because after a reboot, some of the files from the filelist will be deleted.

It is just going to be a lot more challenging to support decompression within feh, when a few line shell script can solve the issue. I have had this PR (#594) up for over a year now and it probably won't get in for the same reason

I understand that it may not be worth it to merge decompression support to feh. That's why I created a feature request and not a pull request. But if enough people are interested in this feature, I think I can simplify the implementation and unify it with libcurl implementation. And supporting libarchive will not be a challenge in this case, as long as libcurl is supported.

Good questions though.

@avlec
Copy link
Contributor

avlec commented Dec 5, 2022

The only other thing I can think of is mounting the archive to the filesystem through something life fuse, it seems to at least work for ZIP archives, see https://linux.die.net/man/1/fuse-zip. Not sure if they'd help with your Comic Book Archive formats, you might have to translate those to a traditional archive then mount them, or you could always implement it yourself ;) but that's definitely non-trivial

@bobrofon
Copy link
Author

bobrofon commented Dec 5, 2022

Actually, I thought about implementing a fuse-based filesystem that will represent regular files/directories as regular files/directories but will transform all archives into directories. But for now a relatively simple feh patch is enough for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants