Sure. Here's my current use case:
After post processing in Lightroom, all images are rendered as JPGs into a separate "rendered" directory partitioned by year. Hazel monitors this directory and imports the files into Photos (Photos then distributes the images to all phones, TVs and tablets through iCloud, but that's beside the point). Here's a pruned example:
- Code: Select all
rendered
├── 2008
│ └── 2008-09-05 Sample album 1
│ ├── 1.jpg
│ └── 2.jpg
└── 2009
└── 2009-03-13 Sample album 2
├── 1.jpg
├── 2.jpg
├── 3.jpg
└── 4.jpg
Hazel creates two folders in Photos named "2008" and "2009" and albums in the respective folder with name "Sample album 1" and "Sample album 2", note that the day timestamps are stripped from the album names. This is currently achieved through this AppleScript that I hacked together yesterday:
- Code: Select all
tell application "Finder"
set albumContainer to container of theFile
set yearContainer to container of albumContainer
# Remove first word from albumName, i.e. "2017-09-18 My album name" => "My album name"
set albumName to do shell script "sed -E 's/^[^ ]* //' <<<" & quoted form of (name of albumContainer as text)
set yearName to name of yearContainer as text
end tell
tell application "Photos"
set existingYears to every folder whose name is yearName
if (count of existingYears) is 0 then
make new folder named yearName
end if
set existingAlbums to every album whose name is albumName
if (count of existingAlbums) is 0 then
make new album named albumName at (get folder yearName)
end if
set targetAlbum to get album albumName
import theFile into targetAlbum skip check duplicates no
end tell
This works, but as so many people use Hazel for image workflows, it would be nice with some extended support for Apple Photos. If we for instance could have actions that creates folders and albums based on the matched file, specify what should happen if folder or album exists, and specify what album a file should be saved in based on a script, I think one could make quite complex image management workflows with Apple Photos as the target application. Importing an image into several albums would also be welcome, I don't think that's currently supported.