Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Add an option for a filter command #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 2, 2023

  1. Add an option for a filter command

    When importing many files (especially from generated backups), there are
    often files which aren't really worth importing. For example, an old
    photo library might include many thumbnails, and these low-resolution
    images don't really belong in my fancy new Immich installation.
    
    This change adds a `--filter <cmd>` argument to the `upload` command.
    This allows the user to pass in a command to be executed (which will be
    passed the full filename as the first argument). If this command (plus
    file) returns a non-zero exit code, the file will not be processed by
    the upload script.
    
     ## Examples
    
    For the below examples, assume that there exists a script called
    `demo.sh` (and is executable) in the current directory.
    
     ### Exclude thumbnails
    
    ```sh
     #!/usr/bin/env bash
    
    grep -q -v _thumb <<< "$1"
    ```
    
     ### Exclude low-resolution images
    
    ```sh
     #!/usr/bin/env bash
    
    W=$(exiftool -ExifImageWidth "$1" | awk -F' : ' '{print $2}')
    H=$(exiftool -ExifImageHeight "$1" | awk -F' : ' '{print $2}')
    
    (( $W > 800 )) && (( $H > 800 ))
    ```
    evancharlton committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    fba2568 View commit details
    Browse the repository at this point in the history