photos
photos copied to clipboard
Import/export workflow from an input/output folders with autorotate, exif stripping, etc
I'll describe the current workflow I have and some proposed approaches to automate it within Nextcloud.
Current workflows
Workflow 1: importing pics
Nextcloud 20 has a shared folder "Pictures" containing all our family pictures organized by folders under "YYYY/YYYY-MM-DD" where YYYY is year, MM month and DD day. There's also an other shared folder "umstiegstation" where wife and I upload pictures taken by mobile phones using instant upload.
The workflow is as follows:
- Family member takes pictures or videos with mobile phone
- Android app uploads to "umstiegstation" using the instant upload feature
- Every now and then, boot up our desktop computer
- Desktop client from desktop computer syncs down "umstiegstation"
- I start "digikam"
- I import the pictures from "umstiegstation" into "Photos/YYYY"
- I delete the imported pictures from "umstiegstation" (note: digikam can recognize if pics were already imported)
- Digikam sorts them using the "YYYY-MM-DD" folder formats
- Digikam automatically rotates the pictures
- Desktop client from desktop computer syncs up the "Photos" folder
Workflow 2: selecting pics for sharing with broader family
The purpose is to share pictures with the broader family with public link. For this I need:
- Videos non viewable in web (ex: MOV) to be converted to WEBM or MP4
- For MP4 videos taken by phone, set the MOOV atom at the beginning with ffmpeg to optimize streaming
- Remove people tags (I usually set them within digikam for easier search)
- Remove GPS metadata
The workflow is as follows:
- Copy selected photos and videos into an "Outbox" folder
- Run a specifically crafted script that does all of the above and which puts the result into a folder "Family/$year-$month/"
- Desktop client syncs up the "Family" folder which is already shared by public link
- Family members open the public link and enjoy viewing the albums in the web UI
Possible approaches to automate this
The goal is to find a common workflow style that would match both importing and exporting as specified above.
Within the photos app
Implement a new feature with a function that takes the following:
- input folder for bulk importing
- output folder with format string
- set of operations like:
- autorotate
- strip tags with specific names
The function should be configurable in the web UI and allow for multiple sets of configurations, in my case it would look like:
- Config workflow 1:
- input: "umstiegstation"
- output: "Pictures/YYYY/YYYY-MM-DD/"
- operations:
- autorotate
- delete from source
- Config workflow 2:
- input: "Outbox"
- output: "Family/YYYY-MM/"
- operations:
- strip tags GPS, etc
- relocate MOOV atom (for videos)
- convert MOV to MP4
- delete from source
If some of operations are too complex, maybe it should just run an additional shell script.
When to run ? Possible ways:
- have a NC cron job do it, but it might take too long and block the cron queue of other jobs
- have an occ command to run periodically (like the preview generator from @rullzer does)
- or have the above configs just be occ commands that one can run periodically
Scripting outside the photos app
An external script could be written that periodically checks the etag of those input folders and then if it changes, scans all the contents and processes its contents like the above, all through the Webdav interface. The conversion would happen locally in temporary space before being uploaded again through Webdav.
Script with Flow app
Use the flow app to run an external shell script. From what I saw the flow app doesn't allow to detect uploads in specific folders, it does so in any folder. So the shell script needs to filter out any outside folder.
Also unclear: not sure if a Flow is allowed to move files around after an upload. (to clarify)
Provide some extra Flows within Photos app
Maybe implement this as flows specific to the photos app and provide said operations there ?
Notes
- Not sure if putting this or parts of this is suitable for the Photos app.
- I'm mostly interested in the import part as it is likely more common than the export one, and that one is likely easier to implement within PHP when no external tools are involved (and more secure)
- Does anyone else have similar workflows and is there user demand for this ? (otherwise I might as well just write external scripts for my own specific purpose)
Here's a gist with the script I currently use for the second export workflow: https://gist.github.com/PVince81/79d0c73ac06ff508a97e68c8d0f0d7fc
I run this on a local machine with a desktop client, so there's no direct Webdav access.