Quicklook and thumbnails for the file system

297 views
Skip to first unread message

Alejandro Exojo

unread,
Jun 21, 2015, 5:04:54 PM6/21/15
to osxfus...@googlegroups.com
Hi.

My file system fetches the contents of the files from the network. The
files are downloaded on demand, so only on the first read the file is
transferred, then is cached for later. This is problematic with the
automatic previewing of the files, of course, since the QuickLook daemon
(I think) will try to read them all just when browsing a folder.

Does someone have any advice on how to improve this? Ideally I'll need
to:

1. Tell the system not to read any files for previews. 2. Give the
system previews for those files myself, since the server has those
generated in advance, so I can download those instead.

For the first part, the user can choose to uncheck the the "Show icon
preview" on Finder's preferences for that directory, but can it be done
from the application?

This is the only promising thing I've found in the archives:

https://groups.google.com/d/msg/osxfuse-group/ZHRwfys9f0U/GofGcSH-_z0J

There it's mentioned that there *were* some `.ql_thumbnails` and
`.ql_disablecache` files that used to work. I've searched the web with
different engines and neither seems to have *any* information about
those. Maybe the names have a typo?

From what I've researched, that Finder setting is stored in .DS_Store. I
was happyly blocking it through the "noappledouble" mount option, but I
could manually block the "._" files and leave the .DS_Store alive for
that setting, or fake its contents on the fly. Did anyone do something
like this?

For the second point I think it might be even more difficult if not
outright impossible. I could create a QuickLook plugin that overrides
the system ones, and use my server for the previews on my mount, falling
back to the default for the remaining files. On Windows, maybe one could
generate a fake Thumbs.db with the previews of the files, and expose it
through the file system.


I hope I'm not the only one with this issue, and maybe somebody can give
any advice. :-)

Thank you in advance.
Greetings.

Lakshmi S

unread,
Sep 24, 2015, 5:20:30 AM9/24/15
to OSXFUSE
Hi Alejandro,

Were you able to fix this issue with quick look generator?

Alejandro Exojo

unread,
Sep 24, 2015, 7:05:29 AM9/24/15
to osxfus...@googlegroups.com

On 24 September 2015 at 11:20, Lakshmi S <slakshm...@gmail.com> wrote:
Were you able to fix this issue with quick look generator?


Not yet. For now, we are *blocking* only QuickLook by looking at the process name on requests, and failing to open if the process is QuickLook-related and the file is not cached. That was point 1.

For point 2, I'm not even sure that's possible, but I'm not familiar with Mac native APIs. The QuickLook API is focused in adding support for a preview of a new file type (foo.xyx or bar.abc). I don't know if one can override all of them, or a set of them. I not sure one can override a generator provided with the system by Apple.

Any kind of input is very welcome! :)

mixtly

unread,
Aug 7, 2019, 9:20:22 PM8/7/19
to OSXFUSE
What I'm currently doing is showing a custom file extension (ie .myextension) on every not-downloaded file so that my QuickLook plugin can generate previews even for files which have not been downloaded.

However, problem there is that I cannot tell finder to refresh the file preview icon.

Another option is for quicklook thumbnail generator to wait for file download to finish but that takes too long to preview all files because quicklook is generating previews in batches of 10 files. So it's like: generate preview for 10 files, and until all previews are fetched, no next preview will be requested.
Additionally, showing document preview will beachball (will be stuck) until all files in a folder (or at least in several Finder scroll windows) have finished thumbnail generating.

I wonder if there is a way to tell Finder to refresh the file thumbnail preview icon programmatically. I tried:
[NSWorkspace noteFileSystemChanged:path];
and
[GMUserFileSystem invalidateItemAtPath:path error:nil];
but without it doesn't reload the finder preview icon.

mixtly

unread,
Aug 8, 2019, 7:01:06 AM8/8/19
to OSXFUSE
In the end here is what I ended with for now:

1. when in QuickLook plugin thumbnail preview callback is called, plugin tries to extract extended attribute 'filePreview' for given file.
2. valueOfExtendedAttribute:ofItemAtPath is called in MainApp and there if file has a downloaded preview image it returns the preview path otherwise it returns nil AND initiates preview download.
3. If QuickLook got the proper preview image path it will use this image as a thumbnail.
4. If preview image did not exist, then download was scheduled in step (2). When download is finished, file is 'touched' ie ("touch <FILE_PATH_IN_VFS>").
5. touching the file results in setAttributes:ofItemAtPath fuse callback with NSFileModificationDate being set. This is then applied to a cloud-file as a new modification date which triggers file thumbnail icon refresh by Finder.
Reply all
Reply to author
Forward
0 new messages