Skip to content

Commit

Permalink
Add helper for choosing AppleScript or PhotoKit for export (#1559)
Browse files Browse the repository at this point in the history
  • Loading branch information
torarnv authored Jun 8, 2024
1 parent ec3117f commit 91933c4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions osxphotos/photoexporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,12 +589,8 @@ def _stage_photos_for_export(self, options: ExportOptions) -> StagedFiles:
staged = StagedFiles()

if options.use_photos_export:
# use Photos AppleScript or PhotoKit to do the export
return (
self._stage_photo_for_export_with_photokit(options=options)
if options.use_photokit
else self._stage_photo_for_export_with_applescript(options=options)
)
return self._stage_missing_photos_for_export_helper(
options=options)

if options.raw_photo and self.photo.has_raw:
staged.raw = self.photo.path_raw
Expand Down Expand Up @@ -649,18 +645,22 @@ def _stage_missing_photos_for_export(
preview=options.preview and not staged.preview,
raw_photo=self.photo.has_raw and options.raw_photo and not staged.raw,
live_photo=self.photo.live_photo and options.live_photo and not live_photo,
use_photokit=options.use_photokit,
)
if options.use_photokit:
missing_staged = self._stage_photo_for_export_with_photokit(
options=missing_options
)
else:
missing_staged = self._stage_photo_for_export_with_applescript(
options=missing_options
)
missing_staged = self._stage_missing_photos_for_export_helper(
options=missing_options)
staged |= missing_staged
return staged

def _stage_missing_photos_for_export_helper(
self, options: ExportOptions
) -> StagedFiles:
"""Stage a photo for export with AppleScript or PhotoKit"""
if options.use_photokit:
return self._stage_photo_for_export_with_photokit(options=options)
else:
return self._stage_photo_for_export_with_applescript(options=options)

def _stage_photo_for_export_with_photokit(
self,
options: ExportOptions,
Expand Down

0 comments on commit 91933c4

Please sign in to comment.