Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --fingerprint option to osxphotos import #1374

Closed
RhetTbull opened this issue Jan 6, 2024 · 0 comments
Closed

Add --fingerprint option to osxphotos import #1374

RhetTbull opened this issue Jan 6, 2024 · 0 comments
Labels
cli Pertains to the command line interface feature request New feature or request

Comments

@RhetTbull
Copy link
Owner

@harveydov

Is there any way to define what checks class a photo as duplicate?

At the moment, there is not. This is what the code currently does:

If item is a photo and there is a fingerprint stored in the database the fingerprint of the photos is compared. In all but a small number of cases, Photos stores a unique fingerprint (a hash of the file) for each photo. osxphotos will call the same fingerprint method used by Photos to compare. Thus a match is only possible if both files are absolutely identical.

If item is a video or the database didn't contain a fingerprint, the code creates a fingerprint of filename + size of the image (in bytes) thus again, there needs to be an exact match. This second method is not as precise as the first and could result in false matches but Photos does not store a fingerprint for videos (I'm guessing because it's a slow operation to compute a fingerprint for a large file).

It would be possible to add a --fingerprint TEMPLATE option that allows you specify a custom fingerprint using the osxphotos template language. For example:

--fingerprint "{filepath.name}{photo.height}{photo.width}"

I will open a new issue for this. This will likely require the user install exiftool to use this as osxphotos would need a way to read the size and other metadata from the image prior to import and I don't want to write custom code to do this.

Note that using height and width would lead to greater likelihood of false matches as all images from a given camera/phone model will have the same height / width (unless cropped).

A templated fingerprint would allow you to use date instead of size or in addition, for example: --fingerprint "{filepath.name}{photo.height}{photo.width}{created}" (though Google mangles the dates by converting everything to UTC...)

Originally posted by @RhetTbull in #1262 (reply in thread)

@RhetTbull RhetTbull added feature request New feature or request cli Pertains to the command line interface labels Jan 6, 2024
RhetTbull added a commit that referenced this issue Apr 28, 2024
RhetTbull added a commit that referenced this issue Jun 8, 2024
* Working on import fixes

* Working on --check

* More work on import check

* Got import check working

* Initial refactor of --check-not

* Working on import code

* Tests passing for import

* Fixed reporting for import

* Fixes #1470, apply sidecar to _edited photos, adds --edited-suffix

* Implements #1373, --favorite-rating

* Updated docs

* Implemented --auto-live, #1399

* Normalizes unicode for album names, #1475

* Added height, width to PhotoInfoFromFile

* Updated test names

* Adds --signature to import, #1374

* Fix test for linux

* Implements PR #1486

* Allow import to accept files or directories as argument

* Fixed error with files_or_dirs

* Added export_directory table

* ExportDB updates to allow reading last export path

* Added --runs to exportdb, updated exportdb tests

* Added photoinfo_from_dict

* Added photoinfo_from_dict tests

* Added --exportdb to import

* Stage files that need modification, added tests

* Refactoring for maintainability

* Refactoring for maintainability

* Refactoring for maintainability

* Changed verbose level

* Fix for files with same stemp when --auto-live is not used

* Handled edited version w/o AAE

* removed print statemetns

* Updated check, check not

* Added tests for importing edited versions

* Refactored to move import_cli code first in file

* Working on _edited photos

* Import of edited files now working

* Updated content_tree to fallback to mdls if needed

* Fixed image_file_utils for non-Spotlight volumes

* Fixed image_file_utils for non-Spotlight volumes

* Removed unneeded imports

* Tests passing for renamed edited photos

* Initial tests for import CLI utils

* Initial tests for import CLI utils

* Fixed regex for finding original / edited images

* Typo (my bad!) on GoPro Pics filename standards. (#1551)

* Added test images for import tests

* Fix for edited live photos

* Fixed skip if not macOS

* Added test for edited live photo

* Added clarification for --resume, --skip-dups, #802

* Fix for certain edited live photos

* Reset counter

* Added --exportdir

* Fixed help formatting

---------

Co-authored-by: oPromessa <mario@silvapereira.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Pertains to the command line interface feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant