pyicloud icon indicating copy to clipboard operation
pyicloud copied to clipboard

Get Photo-Album within Folder

Open Pommesdoktor opened this issue 4 years ago • 9 comments

How can I access Photo Albums, that are with ICloud-Folders? Tried 'Folder/Albumname' and 'Folder\Albumname'. Did not work.

Pommesdoktor avatar Jul 25 '20 18:07 Pommesdoktor

Hello there !

It's written in the doc: https://github.com/picklepete/pyicloud#photo-library

Closing, tell me if the issue persists.

Quentame avatar Aug 05 '20 11:08 Quentame

Hello, the issue still exists.

The doc explains only, how to access photos in the first level album hierarchy, i.e. ‘screenshots’. If the photos are organized with subfolders, i.e. ‘My albums’à’2020’à’Summer’ (here ‘2020’ is a folder, not an album), there is no possibility to access the album ‘Summer’.

api.photos.albums['Summer'] yields ‘not found’, same with api.photos.albums['My Albums/2020/Summer']

Maybe there is a way to access albums within subfolders, which is not documented? Or does Pyicloud not support subfolders?

Best regards

Jörg

Pommesdoktor avatar Aug 07 '20 11:08 Pommesdoktor

Have you tried api.photos.albums['My Albums']['2020']['Summer'] ?

Quentame avatar Aug 07 '20 12:08 Quentame

Unfortunately it doesn’t work.

If I try, i.e.

print(api.photos.albums['2020']['testalbum'])

then I get TypeError: 'PhotoAlbum' object is not subscriptable.

Same error when executing:

for photo in api.photos.albums['2020']['testalbum']:

print(photo, photo.filename)

print(api.photos.albums['2020']) works and gives ‘2020’ in the console

for photo in api.photos.albums['2020']:

print(photo, photo.filename)

gives no error. (there are no photos in the folder ‘2020’)

It would be also very helpful to be able to list all folders and all albums within a folder.

regards

Jörg

Von: Quentame [email protected] Gesendet: Freitag, 7. August 2020 14:16 An: picklepete/pyicloud [email protected] Cc: Matthes, Jörg (IAI) [email protected]; Author [email protected] Betreff: Re: [picklepete/pyicloud] Get Photo-Album within Folder (#288)

Have you tried api.photos.albums['My Albums']['2020']['Summer'] ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/picklepete/pyicloud/issues/288#issuecomment-670487527 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AHTBJTEUDOGVVQB4VCATW2LR7PV7DANCNFSM4PHSRDKQ . https://github.com/notifications/beacon/AHTBJTGF2NPUYKKIWFR62ALR7PV7DA5CNFSM4PHSRDK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE73NHZY.gif

Pommesdoktor avatar Aug 07 '20 12:08 Pommesdoktor

Turns out, subfolders are currently not supported in the code.

https://github.com/picklepete/pyicloud/blob/master/pyicloud/services/photos.py#L176 marks it neatly as a TODO item...

ixs avatar Aug 11 '20 20:08 ixs

Ups, haven't checked 😅

Actually do not have iCloud Photos in my account.

Quentame avatar Aug 11 '20 21:08 Quentame

Hey, I actually just hit this today! After some snooping around at the traffic from iCloud Photos, I was able to enhance the code to distinguish between folders and albums, and then continue to traverse folders looking for more albums.

The changes are over on https://github.com/noizwaves/pyicloud/tree/albums-in-folders. If you'd like, I could polish it up into a PR.

noizwaves avatar Aug 15 '20 02:08 noizwaves

@noizwaves Awesome work. @Quentame is on a vacation for the next days, so your change cannot be merged yet. But I think a PR would be pretty awesome. If you need help polishing your change, I'm happy to help you.

ixs avatar Aug 15 '20 09:08 ixs

OK, finally found some time and landed the PR #297

noizwaves avatar Aug 21 '20 02:08 noizwaves