omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    I want to create folders of albums in Photos app

    Pythonista
    3
    4
    1975
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dotHTM
      dotHTM last edited by dotHTM

      Does the photos module allow creation of "album folders"?

      I've used the photos module to create albums, but folders are a special collection in the Photos app that contain albums or other folders.

      I believe these can normally only be created in the GUI for macOS Photos.app, although they're displayed in iOS Photos.app with no problem.

      1 Reply Last reply Reply Quote 0
      • cvp
        cvp last edited by cvp

        I'm estonished my-self but this little script does what you want. I really don't know anything about objective-c and blocks but I just spent one hour with by my big friend Google and I find some code , some Apple Doc, an @omz example using ObjcBlock (barometer in this forum) and putting all of that together creates the miracle 😂
        Hoping it helps you.

        Nb: before it functions, I got a lot of errors, solved thanks to @dgelessus code here

        from objc_util import *
        	
        def act():
        	print('act')
        	cl = ObjCClass('PHCollectionListChangeRequest')
        	clr = cl.creationRequestForCollectionListWithTitle_('folder_of_albums')
        	
        def eoa():
        	print('eoa')
        
        handler_block = ObjCBlock(act, restype=None, argtypes=None)
        end_block = ObjCBlock(eoa, restype=None, argtypes=None)
        
        ObjCClass('PHPhotoLibrary').sharedPhotoLibrary().performChanges_completionHandler_(handler_block,end_block)
        
        1 Reply Last reply Reply Quote 0
        • TonK
          TonK last edited by

          Is there also a way (with / without objc_util) using Pythonista not to create but to to list (existing) album folders from the Photos app.

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @TonK last edited by cvp

            @TonK

            import photos
            for collection in photos.get_albums():
            	print(collection.title)
            

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors