Code Monkey home page Code Monkey logo

Comments (6)

abentele avatar abentele commented on September 25, 2024

Unfortunatley, after investigating a little bit on this issue, I've seen the macOS API to get the Photos library has been removed by Apple. The used API was MLMediaLibrary, and as you can see on https://developer.apple.com/documentation/medialibrary/mlmediasourcetype, the supported media source types don't include the Photos library any more. Same here: https://developer.apple.com/documentation/medialibrary/mlmedialibrary/media_source_identifiers. In High Sierra there was a constant for it that still exists but isn't documented: https://developer.apple.com/documentation/medialibrary/mlmediasourcephotosidentifier. Apple themselves provided a code sample to access the Photos library, but it's not up-to-date: https://developer.apple.com/library/archive/samplecode/MediaLibraryLoader/Introduction/Intro.html#//apple_ref/doc/uid/TP40017375. It seems that Apple has removed support to read from the Photos library for third party apps.

So, currently I see no simple solution for this issue. I will further investigate on it the next days, because the PhotosExporter has become a very important tool for me, with no alternative.

from photosexporter.

abentele avatar abentele commented on September 25, 2024

I've opened a bug ticket in the Apple Bug tracker, #44856328. Hope to get an answer if there is any alternative API.

from photosexporter.

britiscurious avatar britiscurious commented on September 25, 2024

Thanks for the investigation. My thoughts were in the direction that eventually the new hardened Mojave security were responsible. I changed the options for
self.mediaLibrary = MLMediaLibrary(options: options)
to
[:]
in order to get all mediasources.
The only one I get is iTunes. :-(
So far I store all my photos on a NAS using a folder structer by date.
That way all devices Windows, Mac, DLNA,... are able to show the photos and backup to an arbitrary cloud storage provider is easy.

I didn't want to trap my photos within Photos and iCloud.
But PhotosExporter gave me the opportunity to use Photos and sync it to my NAS.

I really miss Aperture. Lightroom is just to expensive for my needs and there is currently no other DAM that fulfills my needs. Eagerly waiting for Affinity DAM... but still there is nothing on the horizon...

from photosexporter.

abentele avatar abentele commented on September 25, 2024

This is the same I've already tried. The Photos framework aka PhotoKit doesn't contain an API for retrieving photos on the Mac. I assume Apple doesn't support it on the Mac because of the implementation is not ready for features like iCloud Photos or for security reasons.

So we will have to wait for a new API from Apple, maybe forever. In the meantime, we could access the Photos Library's sqlite database to get the relevant meta data to export the photos. This would be a hack, and its likely that Apple will also remove this "backdoor" in the future.

from photosexporter.

abentele avatar abentele commented on September 25, 2024

Apple has closed my bug ticket as duplikate of ticket 44792418, which is currently in status Open.

from photosexporter.

abentele avatar abentele commented on September 25, 2024

fixed with commit 0804b65

As @britiscurious suspected, the access to the Photos Library is more restricted in macOS Mojave.
After this fix, the application should work both with High Sierra and Mojave.
In Mojave, the user will be asked if he wants to grant the privilege to access the Photos Library when starting the application for the first time (this decision can be changed in the System preferences/Security/Privacy panel of Mojave).

If you are already using the application, you have to rename your main.swift file to MainExporter.swift and refactor it's content like in commit 0804b65 (encapsulate it's content in a function named export() ).

The fix consists of:

  • Switch from command line to Cocoa Application (required); the application doesn't show any main window, to simulate a headless command line tool
  • Info.plist with NSPhotoLibraryUsageDescription entry

from photosexporter.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.