Added PhotoInfo.export(); closes #10

This commit is contained in:
Rhet Turnbull
2019-12-14 10:29:06 -08:00
parent d5a5bd41b3
commit 800daf3658
46 changed files with 1354 additions and 33 deletions

22
examples/export.py Normal file
View File

@@ -0,0 +1,22 @@
""" Export all photos to ~/Desktop/export
If file has been edited, export the edited version,
otherwise, export the original version """
import os.path
import osxphotos
photosdb = osxphotos.PhotosDB()
photos = photosdb.photos()
export_path = os.path.expanduser("~/Desktop/export")
for p in photos:
if not p.ismissing():
if p.hasadjustments():
exported = p.export(export_path, edited=True)
else:
exported = p.export(export_path)
print(f"Exported {p.filename()} to {exported}")
else:
print(f"Skipping missing photo: {p.filename()}")