photonixapp / photonix

A modern, web-based photo management server. Run it on your home server and it will let you find the right photo from your collection on any device. Smart filtering is made possible by object recognition, face recognition, location awareness, color analysis and other ML algorithms.
https://photonix.org/
GNU Affero General Public License v3.0
1.85k stars 125 forks source link

Photos with the same date are not imported and create mismatch with thumbnails #347

Open nscendoni opened 3 years ago

nscendoni commented 3 years ago

I imported several hundred of photos from WhatsApp and I noticed several thumbnails associated with the wrong photos. Be aware that WhatAapp remove all the exif from photos.

After some analysis I found that:

  1. Mismatching thumbnails were from photos imported on the same day
  2. Not all the photo imported on that day were available in photonix

Reading the code I found that the method: record_photo in db.py doesn't import new photos with same creation date of another photo already imported. The two photos are considered the same photo and the new photo is processed anyway. A new thumbnail is then generated for the new photo and associated with the old photo.

I guess this was done in order to not import twice the same photo. The match should be done with other attributes than creation date as well. Actually I found this comment in the code: # TODO: Match on file number/file name as well

I'm preparing a push request to solve this issue.

P.S. Thank you for this wonderful project. I was looking for something like this since long time!

Vlad1mir-D commented 3 years ago

@nscendoni Is https://github.com/photonixapp/photonix/pull/348 finished?

nscendoni commented 3 years ago

@Vlad1mir-D Yes, it works with my test photos. Should I implement a test case for that?

damianmoore commented 3 years ago

Hi @nscendoni, thanks for reporting this and thanks @nscendoni for creating a fix. Sorry I've not had a chance to review and merge it yet. A test case would definitely help get it merged if you're up for it.

nscendoni commented 2 years ago

Hi @damianmoore

I've added one test case in the push request. If you want to check the bug before my patch you can copy the test files in the data/photos directory using a command like cp tests/photos/photo_no_metadata_* <where are your photos> Note: it is important to copy the files together so that they have almost the same timestamp. You will see in unpatched photonix only one photo with the thumbnail from the other photo.