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

Link photos from NextCloud #55

Open
derneuere opened this issue Dec 30, 2020 · 20 comments
Open

Link photos from NextCloud #55

derneuere opened this issue Dec 30, 2020 · 20 comments
Labels
backend enhancement New feature or request

Comments

@derneuere
Copy link
Member

derneuere commented Dec 30, 2020

Currently, the Nextcloud Client downloads all the pictures into its own folder.
r/selfhosted would like an option where the original photos are just linked and not downloaded. We would still create the thumbnails and create the tags, but when we open a picture a request goes to the Nextcloud server instead.

We use this client to download the images currently:
https://github.com/owncloud/pyocclient

As I don't think we want to share all pictures via a public link, we want to save the information about the path within the photo. We need a new attribute "nextcloud_address", where we can save the server link and this would signify that the media is on a nextcloud server.

We would only download the image temporarily to create the thumbnails and read the metadata. This should be handled here and here.

We have to change all functions where an original is accessed. This would be currently on "saving metadata to disk / saving favorites" here and "download images" here. We would also need to redirect the request when accessing videos, because we read the original for that here.

@derneuere derneuere added enhancement New feature or request backend labels Dec 30, 2020
@thelittlefireman
Copy link

Great idea ! +1

@derneuere
Copy link
Member Author

Another implementation idea:

Instead of copying, if the two apps live on the same computer then LibrePhotos should take the NextCloud location for photos. If not on the same computer, then get a link to NextCloud’s photo address.

@sysoppl
Copy link
Contributor

sysoppl commented Dec 30, 2020

Is mounting librephotos data folder to nextcloud data folder working? Last time I tried it showed nothing in my admin page (there was no path to select).

@clawoflight
Copy link

This would be great! A further extension would be to use Nextcloud's sharing/permission system to share albums in librephotos, but that would require two-way integration.

@mike-lloyd03
Copy link

I have Nextcloud and Librephotos running on the same machine. I've set the Librephotos photos directory to the photos directory of my Nextcloud data folder. It works but there's a number of reasons why I'm not a fan of this approach and I think something like this suggestion would really be a clean way to integrate the two services.

@tomamplius
Copy link
Contributor

I think that the best practice to share files between multiple service is use file sharing like cifs, nfs or other network file system

@strugee
Copy link
Contributor

strugee commented Mar 9, 2021

Best practice in what context? The issue here is that Nextcloud generally expects its data directory to not be modified externally. A network filesystem would not solve this problem (unless you set it up as an external storage provider in Nextcloud and moved all your photos there, but that comes with a bunch of other problems and limitations). In fact for this use case it would generally make things worse: more moving parts means more things to potentially break and impact performance, for no gain.

@mike-lloyd03
Copy link

Is there currently a recommended approach to pointing Librephotos to Nextcloud photos without having to duplicate the whole photo stash?

@tomamplius
Copy link
Contributor

tomamplius commented Mar 9, 2021

You can use mount.davfs on librephotos data folder

@TheFehr
Copy link

TheFehr commented Mar 9, 2021

I used efrecon/docker-webdav-client like this:
https://gist.github.com/TheFehr/5329944b0130eb8aeb8e14c6d4577180
And seems to be working fine so far only set it up today. So there might be bugs I have not yet caught.

@meichthys
Copy link
Contributor

@TheFehr Did this end up working well for you?

@TheFehr
Copy link

TheFehr commented Mar 6, 2022

I have not been using it very much after setting up.

I don't even have the containers up and running at the moment.

@meichthys
Copy link
Contributor

Ok, thanks for the quick response. I'll give it a shot when i get a chance. Having the photos duplicated is chewing up a lot of storage and backup space!

@meichthys
Copy link
Contributor

In case anyone else is wondering, the method described by @TheFehr in #55 (comment) seems to work quite well. @TheFehr Thanks for providing the Gist. I had been trying to get that davclient container to work for weeks!

@munsuri
Copy link

munsuri commented Apr 21, 2022

I finally got the time to try @TheFehr's suggestion but besides getting the librephotos-docker_davmount_1 instance to run and see within at /mnt/webdrive the photos from my nextcloudURL WebDAV, I can't get them to be processed/linked to Librephotos... @meichthys: Is there anything else I might be missing? Thanks

@munsuri
Copy link

munsuri commented Apr 22, 2022

Got it working after I cleaned ./librephotos directory and restarted librephotos-docker_backend_1 when the message "No connection to backend, try again latter" was showing after several minutes. Once I was able to log in, selected data directory again, the photo processing started!
Also, another observation, when changing nextcloudURL WebDAV in the .env file (and restarting the containers), librephotos didn't recognize any other picture, I had to again clean ./librephotos directory and start over.

@munsuri
Copy link

munsuri commented Apr 24, 2022

After testing for some days #55 (comment), to me it seems to be quite slow:
Screenshot 2022-04-24 173018

INFO:ownphotos:job 07c2cb52-...: geolocate: /data/imgs/IMG-20170730-WA0025.jpg, elapsed: 42.284343

INFO:ownphotos:job 07c2cb52-...: extract date time: /data/imgs/IMG-20170730-WA0025.jpg, elapsed: 84.896152

INFO:ownphotos:job 07c2cb52-...: add location to album dates: /data/imgs/IMG-20170730-WA0025.jpg, elapsed: 84.896853

INFO:ownphotos:job 07c2cb52-...: extract rating: /data/imgs/IMG-20170730-WA0025.jpg, elapsed: 123.172693

INFO:ownphotos:job 07c2cb52-...: extract video length: /data/imgs/IMG-20170730-WA0025.jpg, elapsed: 123.173287

INFO:ownphotos:job 07c2cb52-...: extract faces: /data/imgs/IMG-20170730-WA0025.jpg, elapsed: 123.611234

INFO:ownphotos:job 07c2cb52-...: image processed: /data/imgs/IMG-20170730-WA0025.jpg, elapsed: 123.645108

INFO:ownphotos:job 07c2cb52-...: handling image /data/imgs/IMG-20170730-WA0026.jpg

INFO:ownphotos:job 07c2cb52-...: generate thumbnails: /data/imgs/IMG-20170730-WA0026.jpg, elapsed: 0.237256

INFO:ownphotos:job 07c2cb52-...: calculate aspect ratio: /data/imgs/IMG-20170730-WA0026.jpg, elapsed: 0.263348

INFO:ownphotos:generated places365 captions for image /protected_media/thumbnails_big/154081351a3add7e57105ac3b8965a241.webp.

INFO:ownphotos:job 07c2cb52-...: generate caption: /data/imgs/IMG-20170730-WA0026.jpg, elapsed: 0.39006

INFO:ownphotos:job 07c2cb52-...: geolocate: /data/imgs/IMG-20170730-WA0026.jpg, elapsed: 44.677656

INFO:ownphotos:job 07c2cb52-...: extract date time: /data/imgs/IMG-20170730-WA0026.jpg, elapsed: 86.826832

INFO:ownphotos:job 07c2cb52-...: add location to album dates: /data/imgs/IMG-20170730-WA0026.jpg, elapsed: 86.827442

Fair to say that even though this time nextcloud and librephotos run in the same machine their network is independent (but it worked way faster with librephotos built-in Nextcloud scan support) . I might try to connect them locally if I run of out ideas as it will take too long to process all pics.

@meichthys
Copy link
Contributor

meichthys commented Jun 24, 2022

@munsuri Thanks for following up with your observations.
@derneuere Has there been any progress on linking to Nextcloud Photos in order to prevent duplication of the raw photos? Ive tried the alternatives but since i don't run Nextcloud & LibrePhotos on the same machine, the alternative options to duplicate photos is not very compelling.

@simonSlamka
Copy link

Is there currently a recommended approach to pointing Librephotos to Nextcloud photos without having to duplicate the whole photo stash?

I used symlinks.

@meichthys
Copy link
Contributor

Is there currently a recommended approach to pointing Librephotos to Nextcloud photos without having to duplicate the whole photo stash?

I used symlinks.

This works well on a local machine, but many of us run nextcloud on a different machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend enhancement New feature or request
Projects
None yet
Development

No branches or pull requests