RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
2.04k stars 95 forks source link

When files with duplicate name are edited, the _edited version doesn't match the (1), (2) naming scheme #529

Open RhetTbull opened 2 years ago

RhetTbull commented 2 years ago

See below:

osxphotos export ~/Desktop/export  --preview --verbose --update --selected
...
Exporting 2 photos to /Users/rhet/Desktop/export...
Exporting Frítest.jpg (6071730A-CAEA-4FE8-ADF9-494A51198E6F.jpeg) as Frítest.jpg
Exported new file /Users/rhet/Desktop/export/Frítest.jpg
Exported new file /Users/rhet/Desktop/export/Frítest_preview.jpeg
Exporting Frítest.jpg (B13F4485-94E0-41CD-AF71-913095D62E31.jpeg) as Frítest.jpg
Exported new file /Users/rhet/Desktop/export/Frítest (1).jpg
Exported new file /Users/rhet/Desktop/export/Frítest (1)_preview.jpeg
Exporting edited version of Frítest.jpg (B13F4485-94E0-41CD-AF71-913095D62E31.jpeg) as Frítest_edited.jpeg
Exported new file /Users/rhet/Desktop/export/Frítest_edited.jpeg

The last file exported should have been named /Users/rhet/Desktop/export/Frítest (1)_edited.jpg but instead was named /Users/rhet/Desktop/export/Frítest_edited.jpeg

RhetTbull commented 2 years ago

This is going to take some major rework to fix. The export code is far too complex with part of the work done in the cli and part done _photoinfo_export.py. I need to do a major refactor of the export code.

RhetTbull commented 2 years ago

To reproduce with test library:

oxsxphotos export ~/Desktop/export --db tests/Test-10.15.7.photoslibrary --preview --verbose --update --name Fr

osxphotos version 0.44.9
Using export database /Users/rhet/Desktop/export/.osxphotos_export.db
Processing database /Users/rhet/Dropbox/Code/osxphotos/tests/Test-10.15.7.photoslibrary/database/photos.db
Processing database /Users/rhet/Dropbox/Code/osxphotos/tests/Test-10.15.7.photoslibrary/database/Photos.sqlite
Database locked, creating temporary copy.
Processing database.
Database version: 6000, 5.
Processing persons in photos.
Processing detected faces in photos.
Processing albums.
Processing keywords.
Processing photo details.
Processing import sessions.
Processing additional photo details.
Processing face details.
Processing photo labels.
Processing EXIF details.
Processing computed aesthetic scores.
Processing comments and likes for shared photos.
Processing moments.
Done processing details from Photos library.
Exporting 4 photos to /Users/rhet/Desktop/export...
Exporting Frítest.jpg (B13F4485-94E0-41CD-AF71-913095D62E31.jpeg) as Frítest.jpg
Skipped up to date file /Users/rhet/Desktop/export/Frítest.jpg
Skipped up to date file /Users/rhet/Desktop/export/Frítest_preview.jpeg
Exporting Frítest.jpg (D1D4040D-D141-44E8-93EA-E403D9F63E07.jpeg) as Frítest.jpg
Exported new file /Users/rhet/Desktop/export/Frítest (1).jpg
Exporting edited version of Frítest.jpg (D1D4040D-D141-44E8-93EA-E403D9F63E07.jpeg) as Frítest_edited.jpeg
Exported new file /Users/rhet/Desktop/export/Frítest_edited.jpeg
Exporting Frítest.jpg (A8266C97-9BAF-4AF4-99F3-0013832869B8.jpeg) as Frítest.jpg
Exported new file /Users/rhet/Desktop/export/Frítest (2).jpg
Exporting Frítest.jpg (1793FAAB-DE75-4E25-886C-2BD66C780D6A.jpeg) as Frítest.jpg
Exported new file /Users/rhet/Desktop/export/Frítest (3).jpg
Exported new file /Users/rhet/Desktop/export/Frítest (3)_preview.jpeg
Exporting edited version of Frítest.jpg (1793FAAB-DE75-4E25-886C-2BD66C780D6A.jpeg) as Frítest_edited.jpeg
Exported new file /Users/rhet/Desktop/export/Frítest_edited (1).jpeg
Processed: 4 photos, exported: 6, updated: 0, skipped: 2, updated EXIF data: 0, missing: 0, error: 0

Note: Exporting Frítest.jpg (D1D4040D-D141-44E8-93EA-E403D9F63E07.jpeg) as Frítest.jpg Exported new file /Users/rhet/Desktop/export/Frítest (1).jpg Exporting edited version of Frítest.jpg (D1D4040D-D141-44E8-93EA-E403D9F63E07.jpeg) as Frítest_edited.jpeg Exported new file /Users/rhet/Desktop/export/Frítest_edited.jpeg