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

add support for shared library #156

Merged
merged 10 commits into from
Nov 1, 2023
Merged

Conversation

tymmej
Copy link
Contributor

@tymmej tymmej commented Oct 5, 2023

Requires https://github.com/mandaron/icloudpy/pull/33

There's no support for albums in shared libraries - it looks like problem on API side. Same info is on iCloud.com in browser.

To use shared library there's new config option library. Value is id of library or key can be omitted if default.

Due to fact that albums are not supported only all_albums: false works.

@mandarons mandarons added the blocked-by-icloudpy Blocked by icloudpy library change label Oct 6, 2023
@mandarons mandarons linked an issue Oct 6, 2023 that may be closed by this pull request
@mandarons mandarons added this to the 1.60.0 milestone Oct 6, 2023
# Conflicts:
#	src/config_parser.py
#	src/sync_photos.py
@mandarons mandarons added new feature New feature or request and removed blocked-by-icloudpy Blocked by icloudpy library change labels Oct 12, 2023
@mandarons
Copy link
Owner

Couple of observations:

  1. It looks like only All Photos, Time-Lapse, Videos, Slo-Mo, Bursts, Favorites, Panoramas, Screenshots, Live, Recently Deleted, Hidden albums are available in the shared library.
  2. Personal library name is PrimarySync, shared library name is SharedSync-....

To handle this, I am thinking of providing config.yaml > photos > shared_libraries: <true (default)/false> option. This will allow handling both - personal and shared libraries.

  1. Options applied to personal library will be all_albums, folder_format, filters > albums.
  2. Options applied to both the libraries will be filters > file_sizes.
  3. When shared_libraries: true, all items in all shared libraries will be downloaded in separate folder _shared with nested folder names All Photos, Time-Lapse, Videos, Slo-Mo, Bursts, Favorites, Panoramas, Screenshots, Live, Recently Deleted, Hidden.

Now with so many options in the config file, especially for photos, it is getting confusing. At some point, config file structure will need to be fully revamped. But that's out of scope for this feature.

@tymmej does this approach look okay?

@tymmej
Copy link
Contributor Author

tymmej commented Oct 17, 2023

Looking at Shared Library at iCloud.com there's info "Albums are not yet supported on iCloud.com" so I have hope that it will change in future.

Currently I'm using same docker image with two config.yamls - one for personal library with:

photos:
 destination: "photos"
 remove_obsolete: true
 sync_interval: -1
 all_albums: true
 filters:
   file_sizes: # valid values are original, medium and/or thumb
     - "original"
   albums:
     - "All Photos"
     - "Hidden"
     - "Time-lapse"
     - "Videos"
     - "Slo-mo"
     - "Bursts"
     - "Favorites"
     - "Panoramas"
     - "Screenshots"
     - "Live"
     - "Recently Deleted"

(I ignore All Photos because each photo in my library is at least in one folder)

and for shared:

photos:
 library: "SharedSync-xxx"
 destination: "photos"
 remove_obsolete: true
 sync_interval: -1
 all_albums: false
 folder_format: "%Y/%m"
 filters:
   file_sizes: # valid values are original, medium and/or thumb
     - "original"

I'm providing different path for /app/icloud/photos volume for each run.

As you can see I'm not fan of downloading both libraries with same config.yaml. Therefore _shared shouldn't be added automatically but by user - either by config.yaml (photos > destination) or by docker mounts.

config.yaml > photos > shared_libraries: <true (default)/false> looks like nice feature instead of library key. I think we can assume there's only one Shared Library per user and we can list names.

folder_format should be supported for Shared Libraries - I added it to avoid one huge folder 😄

In future I'll hope there will be possibility to sync both libraries to same path on disk with all_albums: true.
Now - my solution works pretty well (at least for me 😆 ).

@mandarons
Copy link
Owner

mandarons commented Oct 18, 2023

PR tasklist

  • Download all libraries by default
  • Apply albums filter only to PrimarySync library
  • Add libraries filter to specify list of library IDs to download
  • Add tests for shared libraries
  • Update documentation

@mandarons mandarons enabled auto-merge (rebase) November 1, 2023 23:00
auto-merge was automatically disabled November 1, 2023 23:01

Rebase failed

@mandarons mandarons merged commit a4135fd into mandarons:main Nov 1, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[FEATURE] iCloud Photos Shared Library Support
2 participants