immich icon indicating copy to clipboard operation
immich copied to clipboard

Exclusion Patterns doesn't work for new media

Open dronnikovigor opened this issue 1 year ago • 15 comments

The bug

I have a list of Exclusion Patterns. E.g. /mnt/media/library/abc Adding new photos to /mnt/media/library/abc/subfolder/ adds photos to timeline. Old photos doesn't appear.

The OS that Immich Server is running on

OMV 7

Version of Immich Server

v1.117.0

Version of Immich Mobile App

v1.117.0

Platform with the issue

  • [X] Server
  • [ ] Web
  • [ ] Mobile

Your docker-compose.yml content

version: '3.8'
name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    volumes:
      - library:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - ${PHOTOS_PATH}:/mnt/media/library:ro
      - ${VIDEOS_PATH}:/mnt/media/videos:ro
    env_file:
      - stack.env
    devices:
      - /dev/dri:/dev/dri
    environment:
      - TZ=Canada/Eastern
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always
    
  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - stack.env
    restart: always

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:e3b17ba9479deec4b7d1eeec1548a253acc5374d68d3b27937fcfe4df8d18c7e
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always
    volumes:
      - redis:/data

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_USER=${DB_USERNAME}
      - POSTGRES_DB=${DB_DATABASE_NAME}
      - POSTGRES_INITDB_ARGS=--data-checksums
    volumes:
      - postgres:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT SUM(checksum_failures) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_interval: 30s
      start_period: 5m
    command: ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    restart: always

  backup:
    container_name: immich_db_dumper
    image: prodrigestivill/postgres-backup-local:14
    env_file:
      - stack.env
    environment:
      - POSTGRES_HOST=database
      - POSTGRES_CLUSTER=TRUE
      - POSTGRES_USER=${DB_USERNAME}
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_DB=${DB_DATABASE_NAME}
      - SCHEDULE=15 3 */3 * *
      - POSTGRES_EXTRA_OPTS=--clean --if-exists
      - BACKUP_DIR=/db_dumps
    volumes:
      - ${BACKUP_PATH}:/db_dumps
      - backup_data:/var/lib/postgresql/data
      - backups:/backups
    depends_on:
      - database


volumes:
  model-cache:
  redis:
  library:
  postgres:
  backup_data:
  backups:

Your .env content

-

Reproduction steps

  1. Add Exclusion Pattern /mnt/media/library/abc
  2. Add photos to this folder /mnt/media/library/abc/subfolder/
  3. Check that photos appear in timeline

Acceptance criteria: 3. Photos shouldn't appear in timeline

Relevant log output

No response

Additional information

No response

dronnikovigor avatar Oct 04 '24 00:10 dronnikovigor

What is the actual pattern are you using?

alextran1502 avatar Oct 04 '24 00:10 alextran1502

It's /mnt/media/library/Плёнка, it was working at least till mid-July. I'm adding to /mnt/media/library/Плёнка/2024.10.03

dronnikovigor avatar Oct 04 '24 01:10 dronnikovigor

So you want to exclude everything in /mnt/media/library/Плёнка but not /mnt/media/library/Плёнка/2024.10.03?

alextran1502 avatar Oct 04 '24 03:10 alextran1502

Yes, because I also have lots of subfolders that should be also exlcuded (and they are), like /mnt/media/library/Плёнка/2024.08.11, /mnt/media/library/Плёнка/2024.05.15, etc

dronnikovigor avatar Oct 04 '24 15:10 dronnikovigor

@etnoy Is this use case supported?

alextran1502 avatar Oct 04 '24 16:10 alextran1502

Not directly. We have exclusion patterns, not inclusion patterns. Perhaps if you can write a creative regex it could be possible but I'm not clever enough to figure that out

etnoy avatar Oct 04 '24 18:10 etnoy

Perhaps you can try a negation in the glob pattern?

https://www.baeldung.com/linux/globbing-exclude-pattern#using-negation-operators

etnoy avatar Oct 04 '24 18:10 etnoy

not inclusion patterns.

it's not inclusion pattern. It's still exclusion. It should exclude root folder of subfolders. So, another example. I want to exclude full 1996 folder. image

Is this use case supported?

This was working before. I have lots of folders there, that aren't indexed.

dronnikovigor avatar Oct 04 '24 18:10 dronnikovigor

I'm not sure I understand "exclude root folder of subfolders"

Honestly, try chatgpt. It's pretty good att figuring out glob patterns

etnoy avatar Oct 04 '24 18:10 etnoy

@etnoy I added example above. I used pretty simple pattern /mnt/media/library/1996 that was working before. But NOW all new photos added in subfolders of root folder 1996 are indexed. It doesn't sound like pattern issue.

dronnikovigor avatar Oct 04 '24 19:10 dronnikovigor

Please list your full import paths and exclusion patterns

etnoy avatar Oct 04 '24 19:10 etnoy

External libs:

  • /mnt/media/library
  • /mnt/media/videos

Exclusion Patterns:

  • **/*.cr2 - works
  • **/*.orf - works
  • **/*.dng - works
  • **/*.mod - works
  • **/Originals/** - works
  • /mnt/media/library/Плёнка - works only for old files & subfolders. New items added to subfolders are indexed, e.g. /mnt/media/library/Плёнка/2024.10.03/{PHOTOS_HERE.JPG}
  • /mnt/media/library/Technics/PC - works, althought inside it there are lots of subfolders with photos, eg. /mnt/media/library/Technics/PC/MY_PC/{PHOTOS_HERE.JPG}

dronnikovigor avatar Oct 04 '24 19:10 dronnikovigor

New files vs old files should not make a difference. Please turn on verbose logging, do a scan, and check what the logs say.

To me this sounds like a permissions problem, old files have one permission and new files have another

etnoy avatar Oct 04 '24 20:10 etnoy

It's definetely bug in new versions. I just renamed slightly one of old folders, and now it appear in index! 2024.07.18 wasn't visible before. image.

Permissions are identical - 0755. Logs mention finding of new files.

dronnikovigor avatar Oct 05 '24 02:10 dronnikovigor

Well, I renamed /mnt/media/library/Плёнка to /mnt/media/library/Film and changed pattern. Now exclusion is working. Seems like it doesn't work good with cyrillic chars.

dronnikovigor avatar Oct 05 '24 03:10 dronnikovigor

I just double checked with exclusion patterns with cyrillic charaters (and other languages) and it does exclude correctly. Likely you have an issue with non-latin characters on your file system.

Closing this.

etnoy avatar Oct 07 '24 13:10 etnoy