I have written a script that restores the original folder and album structure of my Photos library, to fix a problem that I created accidentally by misusing the iCloud Photo Library on my iPhone. But I wonder if anybody has come up with a better way to deal with issues like this -- which are all too common.
I had used my roughly 20,000-photo Aperture library as the source to create an identical library in Photos on my Mac Pro back in Yosemite. I turned on iCloud Photo Library, and the new Photos library synced correctly to my MacBook Pro. It also synced to my iPhone and iPad, but on both it created a handful of what I call "ghost albums," which I cannot delete and which have incomplete contents or no contents at all. When I upgraded to El Capitan, the problem on the iPhone and iPad did not go away. In a misguided attempt to fix that, I then made the mistake of turning off iCloud Photo Library on my iPhone and then turning it back on. Before I noticed, the entire folder structure of my iCloud Photo Library had disappeared. The photos were still intact in the Photos thingie and in the All Photos album, but my handmade folders and albums were nowhere to be seen.
Then I started playing with the Photos AppleScript dictionary to see whether it might provide a way to fix the problem. I quickly discovered that all of the invisible folders and albums still existed on the Mac Pro -- AppleScript could see and manipulate them without difficulty. They were just invisible in the user interface. They were not even visible in the Deleted Items thingie on my iPhone and iPad.
So, to bring my folder and album structure back, I have written a script that traverses the old but invisible folders and albums, creates a new, parallel folder and album structure with a differently named root folder, creates duplicates of the old albums in the new folders corresponding to the old folder structure, and "adds" the photos (actually, hard links to them, I assume) from each old album into each new album. It even deletes the old albums after populating the new albums, although I will have to write a separate script to delete the old folders. It works like a charm, and I am slowly but surely getting my folder structure back into a visible state.
My question is this: Has anybody done enough scripting with the Photos application in El Capitan to suggest a better approach? The Photos dictionary is woefully limited, compared to Aperture and iPhoto. |