photos icon indicating copy to clipboard operation
photos copied to clipboard

Album dav api

Open icewind1991 opened this issue 3 years ago • 6 comments

Allow creating and managing folders trough dav

  • create albums with mkcol curl -u admin:admin -X MKCOL http://172.19.0.2/remote.php/dav/photos/admin/albums/test
  • add photos using COPY curl -u admin:admin -H 'Destination: http://172.19.0.2/remote.php/dav/photos/admin/albums/test2/2.png' -X COPY http://172.19.0.2/remote.php/dav/files/admin/background.png' note that the destination name is ignored
  • rename albums using MOVE curl -u admin:admin -H 'Destination: http://172.19.0.2/remote.php/dav/photos/admin/albums/test' -X MOVE 'http://172.19.0.2/remote.php/dav/photos/admin/albums/test2'
  • list albums or albums contents with PROPFIND (you can use depth: 2 to list all albums with content included)
  • file names in albums are prefixed by fileid to avoid collisions, you can request the {http://nextcloud.org/ns}file-name property to get the original filename
  • full file can be downloaded from the album dav endpoint, thumbnails can be retrieved from the normal preview api by fileid

icewind1991 avatar Aug 02 '22 14:08 icewind1991

I don't see any way to store the album location

How do we want to store location? coordinates or freeform string?

icewind1991 avatar Aug 08 '22 14:08 icewind1991

How do we want to store location? coordinates or freeform string?

Freeform string

artonge avatar Aug 08 '22 14:08 artonge

Also, could there be a way to have the creation date, the number of items, and a cover picture ? I can be the latest added picture for now. The last two information could be retrieved from fetching the file list, but it won't scale with a lot of albums.

artonge avatar Aug 08 '22 15:08 artonge

Additional work done here: https://github.com/nextcloud/photos/pull/1142

artonge avatar Aug 10 '22 14:08 artonge

Added location and last-photo to albums at {http://nextcloud.org/ns}location and '{http://nextcloud.org/ns}last-photo. The location can be set through PROPPATCH, last-photo is the fileid so you can get a thumbnail for it trough the normal api.

Note that this change re-uses the same migration which will not run automatically if you've already run a previous version of it. You can manually trigger the new changes by deleting the photos_albums and photos_albums_files tables and running occ migrations:execute photos 20000Date20220727125801

icewind1991 avatar Aug 12 '22 14:08 icewind1991

First of all, excuse the boldness. I understand that it is intended for user albums, but can it also be extended as virtual albums filled by applications?.

In principle, perhaps it would only need a flag to indicate that it cannot be edited by the user [1], perhaps change 'location' to 'context' [2], and an 'icon' would be interesting to help the context.

[1]: Ideally, it would be necessary to make an extensive api (Registration of applications, dynamic responses, hooks/events for removal/add photos, similar to searches), but I understand that it would already be beyond the intention of this proposal, and indicating that it cannot be edited and that it is generated automatically may be enough.

[2]: Just a name change, since in an album you don't always organize by places, and it can be used to comment who generates the album. 🤔

[3]: If it's not by location, it may be by the content of the image (recognize, facerecognition, maps apps), and a simple icon would be fine.

Regards, Matias

matiasdelellis avatar Aug 13 '22 00:08 matiasdelellis

@matiasdelellis Thank you for your input! We're iterating on this, currently, this is the scope we're working on. It may be that virtual albums will appear in the future as a refactoring or similar. Right now we're being pragmatic :)

marcelklehr avatar Aug 23 '22 12:08 marcelklehr