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 --signature to osxphotos sync #1740

Open
RhetTbull opened this issue Nov 18, 2024 · 2 comments
Open

Add --signature to osxphotos sync #1740

RhetTbull opened this issue Nov 18, 2024 · 2 comments
Labels
cli Pertains to the command line interface feature request New feature or request

Comments

@RhetTbull
Copy link
Owner

See #1738

Implement the same signature template used in osxphotos import

@RhetTbull RhetTbull added feature request New feature or request cli Pertains to the command line interface labels Nov 18, 2024
@oPromessa
Copy link
Contributor

Looking at photo_signature function code I noticed it generates a new fingerprint from the file on disk when:

  • photo.fingerprint is not defined
  • we're on MacOs

So maybe adding an option on "sync export" to --update-signature-from-file (or a better name) to re-calculate all fingerprints on "sync export" would do the trick?

Would this make sense?

def photo_signature(
photo: PhotoInfo | PhotoInfoFromFile | dict | str | os.PathLike,
exiftool: str | None = None,
) -> str:
"""Compute photo signature for a PhotoInfo, a PhotoInfo dict, or file path"""
if isinstance(photo, dict):
photo = photoinfo_from_dict(photo)
elif not isinstance(photo, PhotoInfo):
photo = PhotoInfoFromFile(photo, exiftool=exiftool)
if photo.shared:
return _shared_photo_signature(photo)
if photo.fingerprint:
return f"{photo.original_filename.lower()}:{photo.fingerprint}"
if photo.path and is_macos:
return f"{photo.original_filename.lower()}:{fingerprint(photo.path)}"
return f"{photo.original_filename.lower()}:{photo.original_filesize}"

@RhetTbull
Copy link
Owner Author

This would work but only for photos that are present on disk. If the photos is missing (not downloaded from iCloud) this would fail.

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

2 participants