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
985 stars 47 forks source link

Download all albums, add album name to file name #130

Closed tymmej closed 11 months ago

tymmej commented 1 year ago

1) Download all albums recursively if new config option Is set 2) Add album name to filename. I'm using photoview to provide online gallery. It uses only filename to identify photos. So if one photo is in multiple albums there's problem. Adding album name to filename solves it.

There's no 100% coverage in unit tests - it requires mocking data for all Smart Albums, I do not know how to do it.

mandarons commented 1 year ago

Wouldn't fixing just #128 solve your problem? Every album (on disk, in its folder) will have unique file name. Per https://github.com/photoview/photoview#main-features, it looks like directories (folders) are mapped to albums in the app. No need to rename the file names with prepended album names.

tymmej commented 1 year ago

No, it doesn't work. I had to add album name to make it work.

For example, I have two albums:

I have same photo in both albums. In current version it will be downloaded to different folders, but same filenames. In photoview photo will be visible only in one folder. Which one? First scanned.

Adding to database happens here. Removing check origURL == nil "fixes" problem, but creates new - every scan adds all photos to database again.

Alternatively I was thinking to add config option to provide custom filename.

mandarons commented 1 year ago

Adding a new config option e.g. globally_unique_filenames = True/False is a good approach. Your case is specific. The solution you proposed is not generic enough to apply for the default use case.

Regarding

In current version it will be downloaded to different folders, but same filenames. In photoview photo will be visible only in one folder. Which one? First scanned.

This seems like a bug in photoview app.

Lastly, please split this PR into two:

  1. Download all albums
  2. Globally unique filenames