karlch / vimiv

An image viewer with vim-like keybindings.
http://karlch.github.io/vimiv/
MIT License
275 stars 15 forks source link

Any way to make it ignore certain files? #85

Open thepenguinthatwants opened 4 years ago

thepenguinthatwants commented 4 years ago

Hi!

I usually have CR2 (RAW image) files in same folder than the JPG. Any way to make vimiv to ignore those files? As it seems vimiv cant render them.

karlch commented 4 years ago

Unfortunately this is not possible and I would consider this a bug in the fileactions.is_image method, it should only return True if the image can also be opened. I will try to find a fix for this in general.

EDIT: Seems like the underlying gdk method: GdkPixbuf.Pixbuf.get_file_info thinks that cr2 images are tiff and thus supported. Not sure how to work around this then. You can probably add a hacky patch to this method though, something along:

def is_image(filename):
    """Check whether a file is an image.

    Args:
        filename: Name of file to check.
    """
    if os.path.splitext(filename)[1].lower() in (".cr2", ):
        return False
    try:
        ...