Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow random access to photos in an album #365

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

partnerinflight
Copy link

Proposed change

For iCloud photo libraries with thousands of photos, fetching metadata for every photo in order to iterate through them becomes prohibitive very quickly. Therefore, we need random access to the photos in a photo album.
Since iCloud won't allow fetching just one photo metadata, we fetch 2 -- just enough to avoid an error.
Also refactored existing metadata fetching code to use the same underlying fetch function.

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:

photoAlbum = api.photos.all
numPhotos = len(photoAlbum)
index = randint(0, numPhotos - 1)
photo = photoAlbum.photo(index)

Additional information

  • This PR fixes or closes issue: fixes 358
  • This PR is related to issue:

Checklist

  • The code change is tested and works locally.
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant