mandarons / icloud-drive-docker

Dockerized iCloud Client - make a local copy of your iCloud documents and photos, and keep it automatically up-to-date.
BSD 3-Clause "New" or "Revised" License
969 stars 46 forks source link

add support for shared library #156

Closed tymmej closed 8 months ago

tymmej commented 9 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

PR tasklist