Skip to content

Commit

Permalink
Fixed issue when publish process must start Photos app and thereby, i…
Browse files Browse the repository at this point in the history
…mport or photo fails.
  • Loading branch information
sto3014 committed Feb 22, 2024
1 parent e781a14 commit 34a24b3
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,18 @@ rendition is marked as skipped.

* Photos of export format original get "original" as format (metadata).
* The format is now the export format, not the file extension.
* Metadata is no longer read-only
* Metadata is no longer read-only

## [2.1.0.1] - 2024-02-22

### Fixed

* Fixed issue when publish process must start Photos app and thereby, import or photo fails.

### Changed

* Remove version from install script




1 change: 0 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"
export SCRIPT_DIR="$(pwd)"
export VERSION=2.0.0.2

echo copy LRPhotos to ~/Library/...
cp -R "./Application Support" ~/Library
Expand Down
2 changes: 1 addition & 1 deletion package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export SOURCE_DIR=$SCRIPT_DIR/src/main/$PACKAGE_NAME.lrdevplugin
export SOURCE_DIR_SERVICES=/Users/dieterstockhausen/Projekte/Automation/Services
export SOURCE_DIR_SCRIPT_LIBRARIES="/Users/dieterstockhausen/Projekte/Automation/Script Libraries/src"
export RESOURCE_DIR=$SCRIPT_DIR/res
export VERSION=2.1.0.0
export VERSION=2.1.0.1
#
# mac
#
Expand Down
2 changes: 1 addition & 1 deletion src/main/lrphotos.lrdevplugin/Info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return {

LrPluginName = 'Photos',
LrToolkitIdentifier = 'at.homebrew.lrphotos',
VERSION = { major = 2, minor = 1, revision = 0, build = 0, },
VERSION = { major = 2, minor = 1, revision = 0, build = 1, },
LrInitPlugin = "InitPlugin.lua",
-- Add the Metadata Definition File
LrMetadataProvider = 'PhotosMetadataDefinition.lua',
Expand Down
21 changes: 20 additions & 1 deletion src/main/lrphotos.lrdevplugin/PhotosImport.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ on importPhoto(imagefile)
tell application "Photos"
set newPhotos to import aliasPhotoFile with skip check duplicates
end tell
log message "id of new photo: " & id of first item of newPhotos
return first item of newPhotos
end importPhoto
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -270,6 +271,8 @@ on import(photoDescriptors, session)
tell script "hbPhotosUtilities"
set targetAlbum to album by path albumName of session with create if not exists
end tell
log message "id of target album: " & id of targetAlbum
log message "class of target album: " & class of targetAlbum
on error e
error "Album " & albumName of session & " could not be found or created. Error was: " & e
end try
Expand Down Expand Up @@ -344,7 +347,10 @@ on import(photoDescriptors, session)
log message "add new photo to album"
set newPhotoList to {}
copy newPhoto to end of newPhotoList
add newPhotoList to aAlbum
log message "id of album " & aAlbumName & " is: " & id of aAlbum
log message "class of album " & aAlbumName & " is: " & class of aAlbum
-- add newPhotoList to aAlbum
add newPhotoList to album id (aAlbum's id)
on error e
error "Can't add imported photos to album '" & aAlbumName & "'. Maybe it's a smart album and you should exlude it. Error was: " & e
end try
Expand Down Expand Up @@ -874,6 +880,18 @@ on testImport()
set thePath to getPathByAlbum(targetAlbum)
set dummy to 0
end testImport

-------------------------------------------------------------------------------
-- startPhotos
-------------------------------------------------------------------------------
on startPhotos()
if application "Photos" is not running then
tell application "Photos"
activate
delay 3
end tell
end if
end startPhotos
-------------------------------------------------------------------------------
-- Run the import script
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -916,6 +934,7 @@ on run argv
close access photosFile
local photoDescriptors
set photoDescriptors to getPhotoDescriptors(photosContents)
-- startPhotos()
if mode of session is equal to "publish" then
set importedPhotos to import(photoDescriptors, session)
if (count of importedPhotos) is equal to 0 then
Expand Down
Binary file not shown.

0 comments on commit 34a24b3

Please sign in to comment.