immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
42.8k stars 2.08k forks source link

[BUG] Old live photo videos are still visible as separate entries in the album #1873

Closed PeterBasista closed 1 year ago

PeterBasista commented 1 year ago

The bug

After the last update the option to pair live photos automatically was added, the only thing you need to do is to extract the metadata again. I did this step and all live photos paired nicely. But after pairing there was a problem. In the albums that have already been made, the video still shows and the livephoto next to it (when clicked, it also starts to move).

This problem does not occur on the main screen. Only for albums.

The problem is that the assets are selected in the albums according to what is in the DB but it doesn't check if the given item is "isVisible" or not.

*I have already reported this problem once, but it was only a problem for me as I was pairing live photos manually.

The OS that Immich Server is running on

Rasbian 10 buster

Version of Immich Server

v1.49.0

Version of Immich Mobile App

1.49.0 build.87

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-server.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      # add cert via read only volume
      #- /path/to/my-ca-cert:/ca-certs/my-ca-cert:ro
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
      #- NODE_EXTRA_CA_CERTS=/ca-certs/my-ca-cert
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-microservices.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    image: altran1502/immich-machine-learning:release
    command: [ "python", "src/main.py" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - model-cache:/cache
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
    depends_on:
      - database
    profiles:
      - donotstart
    restart: always

  immich-web:
    image: altran1502/immich-web:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    env_file:
      - stack.env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

  database:
    container_name: immich_postgres
    image: postgres:14
    env_file:
      - stack.env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: altran1502/immich-proxy:release
    environment:
      # Make sure these values get passed through from the env file
      - IMMICH_SERVER_URL
      - IMMICH_WEB_URL
    ports:
      - 2283:8080
    logging:
      driver: none
    depends_on:
      - immich-server
    restart: always

volumes:
  pgdata:
  model-cache:

Your .env content

DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich
REDIS_HOSTNAME=immich_redis
UPLOAD_LOCATION=/srv/dev-disk-by-uuid-8d12abc7-14c7-49d5-9d0e-ed350f5f74eb/immich-photos
LOG_LEVEL=simple
JWT_SECRET=nope
PUBLIC_LOGIN_PAGE_MESSAGE=

Reproduction steps

1. upload live photo to immich (as separate files) *The immich version must not contain the pairing functionality in version 1.49.0
2. the photo and video [live photo] is displayed separately on the main screen
3. add these items to the album
4. now update the immich version or start the functionality for matching live photos that were already on the server
5. One item (livephoto) appears on the main screen. But if you look in the album, there will be one video and one livephoto

Additional information

main album
zackpollard commented 1 year ago

Hey, thanks for reporting this issue. I think as this is something that won't happen moving forward, it might be a case of manually fixing them in your instance. It should be relatively simple to do with a SQL query, if you want help with that then let us know!

PeterBasista commented 1 year ago

Thank you very much for the information.

In this case, I am closing the BUG and also providing an SQL command for future searchers.

DELETE FROM albums_assets_assets
where "assetsId" in (
    select "assetsId" from albums_assets_assets aaa 
    left join assets a on aaa."assetsId" = a.id 
    where a."isVisible" = false
);
jrasm91 commented 1 year ago

I believe the issue is that both asset ids (for still and motion) were added to the album and then one of them was set to isVisible: false afterwards (via the auto-linking process). So two things are going on here:

So, have to agree with @zackpollard here, the easiest thing would just be to manually clean them up. We theoretically could have written code to do this as part of the last release, but we're minimizing how much effort we spend on "one time fixes" like this.