r/ObjectiveC • u/lignumScientiae • Mar 16 '20
Absolute minimum objective-c needed to read meta data for files in the Apple Desktop Photos App?
I'm considering a project that will let me upload photos/movies (almost) directly from the Photos App on my Mac to a remote Linux gallery. (Basically, I don't want to pay Apple for cloud-photo storage.)
What I don't want to do is to have to export every photo/movie in my Photos Library since that will create massive duplications on my laptop disk. I'm therefore thinking of working with the original image/movie files stored in ~/Pictures/Photos Library.photoslibrary/originals. The problem with that is that these files lack much of the metadata that is created along the iPhone-Photos creation/upload sequence.
For example, if I have a photo in my Photos App named `IMG_8431.HEIC`, then exporting this file to `IMG_8431.jpeg` will create a file with EXIF data that includes captions, location, etc. Prior to export, that information resides (I presume) in a local proprietary DB that associates the metadata with a file in the ~/Pictures/Photos Library.photoslibrary/originals folder. For my approach to work, I therefore need to be able to extract the metadata from the DB for the Photos App. According to this post , such meta data can be extracted using the objective-C "Media Library Framework". I don't know any objective-C, and I'm certainly not going to learn a whole language/framework for this one little task, so here is my question/request:
What is the absolute minimum objective-c code (+ compilation process) required to ping my local 'Media Library Framework' endpoint and e.g. dump to a file all of the metadata required to make the file-to-data associations I seek?
If I had such a simple black-box command-line executable, then I'm confident I could complete the rest of this photo-sharing project. (I'd write the rest of it with the LAMP stack and definitely make it open source.)
Thanks!
View all comments
Show parent comment
1
u/lignumScientiae Mar 17 '20
Oh, great, didn't realize it was just SQLite! (It would have paid to look in the dir 'databases' after all.) Not sure what you mean by 'Core Data' here. Ive been exploring
Photos.sqlite, Seems like the following query gets me most of what I want:... though I can't figure out what timestamp format Apple is using. It seems to be off the unixepoch by 31 years. Any ideas anyone?