Feature request: Variable album names in Apple Photos

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Hi,

Can we please have album names in Apple Photos based on script output?

With Apple's recent upgrade of Apple Photos, I think it will find a place in more peoples photo management workflows. The action "Import to Photos" requires users to statically define target album at the time of workflow definition. It would be very much more useful if it could invoke a script, and use say the last line printed to stdout as the album name.
merol
 
Posts: 6
Joined: Sun Oct 01, 2017 9:24 am

Can you give me examples of what kind of naming scheme you'd want to implement?
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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.
merol
 
Posts: 6
Joined: Sun Oct 01, 2017 9:24 am

Thanks for that. It's something I've considered though it's a rarely requested feature and there are some interface issues to deal with. Nonetheless, I'll consider this another vote for it. If anyone else wants to request this, please provide examples as that goes a long way towards helping me decide how to design the feature.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion