diff --git a/CHANGELOG.md b/CHANGELOG.md index ed22545..fdd1dfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,7 +69,7 @@ rendition is marked as skipped. * Refactored AppleScript scripts -## [2.1.0.0] - 2024-02-11 +## [2.1.0.0] - 2024-02-18 ### Added @@ -80,6 +80,7 @@ rendition is marked as skipped. ### Fixed * Fixed issue when running multiple jobs. +* Fixed issue when removing photos from albums. * Fixed issue with albums which contains photos without any keywords. ### Changed diff --git a/README.md b/README.md index dcd55bc..78de281 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ LRPhotos is a Lightroom Classic publishing service for Apple's Photos app. --- -1. Download the zip archive from [GitHub](https://github.com/sto3014/LRPhotos/blob/main/target/LRPhotos2.0.0.2_mac.zip). +1. Download the zip archive from [GitHub](https://github.com/sto3014/LRPhotos/blob/main/target/LRPhotos2.1.0.0_mac.zip). 2. Extract the archive in the download folder 3. Copy plug-in, applescript files and automator workflow into ~/Library Open a terminal window, change to Downloads/LRPhotos and execute install.sh: @@ -38,9 +38,8 @@ LRPhotos is a Lightroom Classic publishing service for Apple's Photos app. * hbPhotosDisplayID.workflow 4. Restart Lightroom -Adobe Lightroom Classic needs to access System Events using Apple Script. When you try to access the Photos app for the +Adobe Lightroom Classic needs to access System Events using Apple Script. When you access the Photos app for the first time, the system will ask for permission. -sudo tccutil reset AppleEvents com.adobe.LightroomClassicCC7 ## Usage @@ -49,16 +48,16 @@ sudo tccutil reset AppleEvents com.adobe.LightroomClassicCC7 The publish process… * imports photos into Photos.app * the file name of the photo will be different from the file name in Lightroom. - * The name is set to the photo ID in Lightroom. This ID is displayed also in the metadata of Lightroom. - * The suffix reflects the format which is used during publishing. The suffix is displayed also in the metadata - of Lightroom. -* sets tag - * LR:<name of LR catalog file> + * The name is set to the photo ID in Lightroom. This ID is also displayed in the Lightroom metadata. + * The suffix reflects the format which is used during publishing. The format is also displayed in the Lightroom + metadata. For export data in "original" format, the format value is original. +* sets keywords in Photos + * lr:<name of the Lightroom catalog file> * album:<name of collection> -* saves "Photos App" metadata in Lightroom +* saves "Photos app" metadata in Lightroom * Lightroom catalog: The name of lightroom catalog * Lightroom ID: The internal Lightroom id - * Format: The format (i.e. extension of the Photos file) + * Format: The format of the Photos file * Photos UUID: The unique Photos ID When creating a new publishing service, there are three predefined options which are not default by Adobe: @@ -66,21 +65,25 @@ When creating a new publishing service, there are three predefined options which * Person info will NOT be removed from metadata * Location info will NOT be removed from metadata -Remarks: If you don't export videos as original the create date of the video will be set to the current date. +Remarks: If you don't export videos as original, the create-date of the video will be set to the current date. Of course, you may change these settings for your service definition. ### Re-Publishing The re-publishing process… * puts re-published photos into the same albums as their predecessors. -* puts tag __LR:out-of-date__ on the predecessor +* puts tag __lr:out-of-date__ on the predecessor * removes out-of-date photos if collection configuration __Keep out of date photos in albums__ is un-checked. ### Remove photos from publishing service * Removes the photo from the Photos album. -* Set tag __LR:no-longer-published__ to the current media item in Photos if it is no longer used in any album -* Set back the Photos ID in Lightroom, if the photo is no longer used in any album. +* Set tag __lr:no-longer-published__ to the current media item in Photos if it is no longer used in any album +* Set back the Photos metadata in Lightroom, if the photo is no longer used in any album. + +### Deleting collections + +Deleting collections and removing photos from the Photos app is currently not supported. ### Configuration The __Use Album__ configuration in the publishing service setup defines the name of the album where photos are imported in. @@ -116,14 +119,50 @@ The applescript interface for Photos.app is restricted: recreated if __Keep out of date photos in albums__ is unchecked. ### Update albums -You must delete "old" photos manually after a re-publish. -Therefore, a smart album helps which filters by LR:out-of-date tag and may be by LR: as well. + +You can delete "old" photos manually after a re-publish. +Therefore, a smart album helps which filters by lr:out-of-date tag and may be by lr: as well. ### Update smart albums If you are using shared albums, you must manually add the updated photos into these albums. Therefore, a second smart album is helpful which filters by the date, when photos were added to Photos.app. +## Maintenance + +Three menu action under Library/Plug-In Extras + +* Reset Photos app Attributes +* Search extra Photos in Photos app +* Search missing Photos in Photos app + +### Reset Photos App Attributes + +This action deletes the 4 metadata values on the selected photos. The action may be helpful if you want to delete a lot +of published photos manually and you do not want to use the normal removal process. + +### Search extra Photos in Photos App + +This action searches for Photos app media items that still have a lr:catalog-name keyword, but they are no longer +published +in Lightroom. This happens, when you delete a published collection, or when the publish process runs into a timeout (see +[Known Issues](#known-issues)) +The action adds the additional photos found to the album Photos /Lightroom/Extra Photos. +You do not need to select any photos for this action. All photos will be included that have the Photos UUID metadata +set. + +### Search missing Photos in Photos App + +This action searches for published photos in Lightroom for which no photo can be found in the Photos app. Missing photos +occur when published photos were deleted manually in the Photos app. The action adds the missing photos in the +Lightroom collection /Photos app/Missing in Photos. +The search will be only done for the selected photos (unpublished photos will be ignored). + +## Known issues +* When adding a lot of photos, or when you update a large album, Photos displays a modal dialog, to inform you that many + photos were added. Since the Photos app window may not be in the foreground, you miss this dialog and after a timeout the + publish action fails. +. ## Acknowledgements -- diff --git a/src/main/lrphotos.lrdevplugin/PhotosMaintenance.applescript b/src/main/lrphotos.lrdevplugin/PhotosMaintenance.applescript index 4688659..f707dfc 100644 --- a/src/main/lrphotos.lrdevplugin/PhotosMaintenance.applescript +++ b/src/main/lrphotos.lrdevplugin/PhotosMaintenance.applescript @@ -239,6 +239,7 @@ on processExtraPhotos(comDir, catalogNames, albumName) if (count of extraMediaItems) is greater than 0 then tell script "hbPhotosUtilities" to set targetAlbum to album by path albumName with create if not exists tell application "Photos" + activate add extraMediaItems to targetAlbum spotlight targetAlbum end tell diff --git a/src/main/lrphotos.lrdevplugin/PhotosPublishTask.lua b/src/main/lrphotos.lrdevplugin/PhotosPublishTask.lua index 9fbfff3..455ae23 100755 --- a/src/main/lrphotos.lrdevplugin/PhotosPublishTask.lua +++ b/src/main/lrphotos.lrdevplugin/PhotosPublishTask.lua @@ -20,7 +20,7 @@ local editionDetailsID = "at.homebrew.lreditiondetails" PhotosPublishTask = {} -local LrMobdebug = import 'LrMobdebug' -- Import LR/ZeroBrane debug module +-- local LrMobdebug = import 'LrMobdebug' -- Import LR/ZeroBrane debug module --[[--------------------------------------------------------------------------- local functions -----------------------------------------------------------------------------]] @@ -377,8 +377,6 @@ end function PhotosPublishTask.processRenderedPhotos(_, exportContext) logger.trace("PhotosPublishTask.processRenderedPhotos start") logger.trace("collection=" .. exportContext.publishedCollectionInfo.name) - LrMobdebug.start() - LrMobdebug.on() local albumPath = getFullAlbumPath( exportContext.propertyTable.albumBy, @@ -562,6 +560,18 @@ function PhotosPublishTask.deletePhotosFromPublishedCollection(publishSettings, end +--[[--------------------------------------------------------------------------- + deletePublishedCollection +-----------------------------------------------------------------------------]] +function PhotosPublishTask.deletePublishedCollection( publishSettings, info ) + LrDialogs.message(LOC("$$$/Photos/Msg/Title/DeletePublishedCollection=Deleting collection"), + LOC("$$$/Photos/Msg/DeletePublishedCollection=Deleting collections and removing photos from the Photos app is currently not supported.")) + error(LOC("$$$/Photos/Msg/DeletePublishedCollection=Deleting collections and removing photos from the Photos app is currently not supported.")) +end + +--[[--------------------------------------------------------------------------- + showPhoto +-----------------------------------------------------------------------------]] local function showPhoto(thePhoto) local photoId = PhotosAPI.getPhotosId(thePhoto) local queueEntry = createQueueEntry("Show photo " .. photoId) @@ -579,13 +589,20 @@ local function showPhoto(thePhoto) return result end +--[[--------------------------------------------------------------------------- + goToPublishedPhoto +-----------------------------------------------------------------------------]] function PhotosPublishTask.goToPublishedPhoto( publishSettings, info ) logger.trace("goToPublishedPhoto() start") showPhoto(info.photo) logger.trace("goToPublishedPhoto() end") end -function showCollection(publishSettings, info) +--[[--------------------------------------------------------------------------- + showCollection +-----------------------------------------------------------------------------]] + +local function showCollection(publishSettings, info) local albumPath = getFullAlbumPath( publishSettings.albumBy, publishSettings.useAlbum, @@ -608,6 +625,9 @@ function showCollection(publishSettings, info) return result end +--[[--------------------------------------------------------------------------- +goToPublishedCollection +-----------------------------------------------------------------------------]] function PhotosPublishTask.goToPublishedCollection( publishSettings, info ) logger.trace("goToPublishedCollection() start") showCollection(publishSettings, info) diff --git a/src/main/lrphotos.lrdevplugin/PhotosServiceProvider.lua b/src/main/lrphotos.lrdevplugin/PhotosServiceProvider.lua index 6a1fd27..7c24134 100755 --- a/src/main/lrphotos.lrdevplugin/PhotosServiceProvider.lua +++ b/src/main/lrphotos.lrdevplugin/PhotosServiceProvider.lua @@ -29,6 +29,7 @@ local PhotosServiceProvider = { viewForCollectionSettings = PhotosPublishTask.viewForCollectionSettings, viewForCollectionSetSettings = PhotosPublishTask.viewForCollectionSetSettings, deletePhotosFromPublishedCollection = PhotosPublishTask.deletePhotosFromPublishedCollection, + deletePublishedCollection= PhotosPublishTask.deletePublishedCollection, titleForGoToPublishedPhoto=LOC "$$$/Photos/TitleForGoToPublishedPhoto=Show in Photos", titleForGoToPublishedCollection = LOC "$$$/Photos/TitleForGoToPublishedCollection=Show album in Photos", goToPublishedPhoto=PhotosPublishTask.goToPublishedPhoto, diff --git a/src/main/lrphotos.lrdevplugin/SearchExtraPhotosInPhotos.lua b/src/main/lrphotos.lrdevplugin/SearchExtraPhotosInPhotos.lua index 11841fe..7d636b2 100644 --- a/src/main/lrphotos.lrdevplugin/SearchExtraPhotosInPhotos.lua +++ b/src/main/lrphotos.lrdevplugin/SearchExtraPhotosInPhotos.lua @@ -73,19 +73,16 @@ local function sendPhotosToApp(action, maintenanceDir, catalogNames, albumName) local command = "" LrFileUtils.delete(maintenanceDir .. "/fromPhotos/photos.txt") - logger.trace("1") local exePathDev = _PLUGIN.path .. "/" .. "PhotosMaintenance/PhotosMaintenance.app" local exePathProd = _PLUGIN.path .. "/" .. "PhotosMaintenance.app" logger.trace("exePathDev=" .. tostring(exePathDev)) if LrFileUtils.exists(exePathDev) then - logger.trace("2") command = "osascript \"" .. exePathDev .. "\"" .. " " .. action .. " \"" .. maintenanceDir .. "\"" .. " \"" .. catalogNames .. "\"" .. " \"" .. albumName .. "\"" else - logger.trace("3") command = "osascript \"" .. exePathProd .. "\"" .. " " .. action .. " \"" .. maintenanceDir .. "\"" diff --git a/src/main/lrphotos.lrdevplugin/SearchMissingPhotosInLightroom.lua b/src/main/lrphotos.lrdevplugin/SearchMissingPhotosInLightroom.lua index 50cd5ab..cf3e977 100644 --- a/src/main/lrphotos.lrdevplugin/SearchMissingPhotosInLightroom.lua +++ b/src/main/lrphotos.lrdevplugin/SearchMissingPhotosInLightroom.lua @@ -100,17 +100,14 @@ local function sendPhotosToApp(action, maintenanceDir) local command = "" LrFileUtils.delete(maintenanceDir .. "/fromPhotos/photos.txt") - logger.trace("1") local exePathDev = _PLUGIN.path .. "/" .. "PhotosMaintenance/PhotosMaintenance.app" local exePathProd = _PLUGIN.path .. "/" .. "PhotosMaintenance.app" logger.trace("exePathDev=" .. tostring(exePathDev)) if LrFileUtils.exists(exePathDev) then - logger.trace("2") command = "osascript \"" .. exePathDev .. "\" " .. action .. " \"" .. maintenanceDir .. "\"" else - logger.trace("3") command = "osascript \"" .. exePathProd .. "\" " .. action .. " \"" .. maintenanceDir .. "\"" diff --git a/src/main/lrphotos.lrdevplugin/TranslatedStrings_de.txt b/src/main/lrphotos.lrdevplugin/TranslatedStrings_de.txt index 7851f99..528c95c 100644 --- a/src/main/lrphotos.lrdevplugin/TranslatedStrings_de.txt +++ b/src/main/lrphotos.lrdevplugin/TranslatedStrings_de.txt @@ -53,3 +53,6 @@ "$$$/Photos/Error/ExtraPhotos=Fehler in Fotos App bei der Suche nach fehlenden Referenzen." "$$$/Photos/MsgError/GeneralError=Fehler bei der Suche nach überzähligen Fotos. Meldung war: ^1" "$$$/Photos/MsgError/ExtraPhotosFound=^1 überzählige(s) Foto(s) gefunden. Siehe Album '^2 für eine Liste von extra Fotos." +"$$$/Photos/Progress/DeletePublishedCollection=Lösche publizierte Sammlung ^[^1^]" +"$$$/Photos/Msg/DeletePublishedCollection=Das Löschen von Sammlungen und das Entfernen von Fotos aus der Fotos-App wird derzeit nicht unterstützt." +"$$$/Photos/Msg/Title/DeletePublishedCollection=Löschen Sammlung" \ No newline at end of file diff --git a/src/main/lrphotos.lrdevplugin/TranslatedStrings_en.txt b/src/main/lrphotos.lrdevplugin/TranslatedStrings_en.txt index 1d49e4c..9a9814d 100644 --- a/src/main/lrphotos.lrdevplugin/TranslatedStrings_en.txt +++ b/src/main/lrphotos.lrdevplugin/TranslatedStrings_en.txt @@ -57,3 +57,7 @@ "$$$/Photos/MsgError/GeneralErrorExtra=Error while searching for extra photos. Message was: ^1" "$$$/Photos/MsgError/GeneralErrorMissing=Error while searching for missing references. Message was: ^1" "$$$/Photos/MsgError/ExtraPhotosFound=^1 extra photo(s) found. See album '^2' for a list of extra photos." +"$$$/Photos/Progress/DeletePublishedCollection=Deleting published collection ^[^1^]" +"$$$/Photos/Msg/Title/DeletePublishedCollection=Deleting collection" +"$$$/Photos/Msg/DeletePublishedCollection=Deleting collections and removing photos from the Photos app is currently not supported." + diff --git a/target/LRPhotos2.0.0.3_mac.zip b/target/LRPhotos2.1.0.0_mac.zip similarity index 61% rename from target/LRPhotos2.0.0.3_mac.zip rename to target/LRPhotos2.1.0.0_mac.zip index d1202ec..fd1700a 100644 Binary files a/target/LRPhotos2.0.0.3_mac.zip and b/target/LRPhotos2.1.0.0_mac.zip differ