#!/usr/bin/env bash # Copyright: Julien Moutinho # License: AGPL-3.0-or-later # Usage: # $ mv julm/2023/src/02/IMG_20230228_111645{,.fav}.jpg # $ echo >julm/2023/src/02/IMG_20230228_111645.fav.txt "Some HTML comment about the picture" # $ ./index.sh julm/2023/src/02 # $ sensible-browser julm/2023/fav/02/index.html # # NginxConfig: # locations."/julm/perso/camera/" = { # alias = "${root}/julm/perso/camera/"; # basicAuthFile = "/run/credentials/nginx.service/autogeree.net.www.julm.perso.camera.htpasswd"; # }; # # Disable basicAuthFile for by-uuid # locations."~ ^/julm/perso/camera/([0-9]+/[0-9][0-9]/by-uuid/[0-9a-f-]+/.+)$" = { # alias = "${root}/julm/perso/camera/$1"; # }; # shellcheck disable=SC2086 cd "${0%/*}" set -eu shopt -s nullglob ffmpeg_ () { local -; set -x; nice -19 time ffmpeg &2 "$@"; } for dir in "$@"; do IFS=/ read -r user year x month x <<<"$dir" test -n "$year" || exec "$0" "$user"/2*/src/*/ test -n "$month" || exec "$0" "$user"/"$year"/src/*/ pushd "$user/$year" >/dev/null test -d src || { popd; continue; } mkdir -p fav # cp, not ln, because in push.sh --copy-links cannot be used for by-uuid/ cp -f --remove-destination -t fav ../../index.css test -d src/"$month" || { popd; continue; } unset creationDoMOld unset creationDateOld mkdir -p tmp/fav/"$month" { genDate=$(date +%s) cat < camera/$user/$year/$month