pyicloud icon indicating copy to clipboard operation
pyicloud copied to clipboard

Fetch albums in folders for iCloud Photos

Open noizwaves opened this issue 4 years ago • 5 comments

Proposed change

This PR enhances the PhotosService to traverse sub-folders when it retrieves albums. The initial implementation only shallowly iterated over items in the root folder. The code has been changed to first determine if an item is actually a folder, and if so to query iCloud for any albums inside of it.

The ancestry or "lineage" of an album is also tracked in a new field PhotoAlbum.lineage; the names of each parent directory are included in this list. The definition of PhotoAlbum.__unicode__ has been enhanced to include this information in a path-esque way. The aim is to better represent the actual "path" within an iCloud Library.

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] New service (thank you!)
  • [x] New feature (which adds functionality to an existing service)
  • [ ] Breaking change (fix/feature causing existing functionality to break)
  • [ ] Code quality improvements to existing code or addition of tests
  • [ ] Documentation or code sample

Example of code:

for name, album in api.photos.albums.items():
    print(name, album.lineage, str(album))

Additionally, I used a local build of this package in this script to download the details of all of my albums. My library consists of albums at the root level, albums in a single folder, and albums nested within multiple levels of folders.

Additional information

  • This PR fixes or closes issue: fixes #288
  • This PR is related to issue:

Checklist

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [ ] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • [ ] Documentation added/updated to README

noizwaves avatar Aug 21 '20 02:08 noizwaves

Thanks for the feedback @ixs! I've just fixed up the failing CI checks (formatting issues), so I think we're technically mergeable now. Do you still want a review from @Quentame?

noizwaves avatar Aug 29 '20 17:08 noizwaves

@noizwaves I saw the changes. I liked them. Thanks for that. But yes, @Quentame has to review. I got no commit rights on this repo. And he's on vacation for a few more days. So patience. 😁

ixs avatar Aug 29 '20 19:08 ixs

Hello @Quentame, what is the the status on this PR?

kpiwko avatar Nov 01 '20 10:11 kpiwko

Hello @Quentame, what is the the status on this PR?

@noizwaves and @Quentame, is there still something that needs to be done for this PR or do you need help on anything? I'm looking forward to getting this PR completed.

Roelio81 avatar Feb 16 '21 08:02 Roelio81

Hi, can this be pulled please? This is a crucial feature for a project I'm working on. Thanks!

mm21 avatar Oct 09 '22 22:10 mm21