Initial files.

master
Holger Wirtz 5 years ago
parent 0767239f30
commit 243aa1ac1a
  1. 40
      bin/timelapse_daily.sh
  2. 41
      bin/timelapse_gatherer.sh
  3. 49
      bin/timelapse_monthly.sh
  4. 47
      bin/timelapse_video.sh
  5. 56
      bin/timelapse_weekly.sh
  6. 46
      bin/timelapse_yearly.sh
  7. 43
      client/timelapse.sh

@ -0,0 +1,40 @@
#!/bin/bash
DATA_DEVICE_UUID="C6CE6C2BCE6C1649"
MOUNT_PATH="/mnt/extern"
DATA="${MOUNT_PATH}/timelapse"
CLIENT="timelapse@192.168.111.2"
CLIENT_FOLDER="/timelapse"
if [[ "${1}" =~ [0-9]{8} ]]
then
DATE=${1}
else
DATE=`date --date="1 day ago" +%Y%m%d`
fi
mountpoint -q ${MOUNT_PATH}
if [ ${?} != 0 ]
then
sudo mount --uuid ${DATA_DEVICE_UUID} -o uid=1000,gid=1000,umask=0022 ${MOUNT_PATH} || echo "Cannot mount data device with UUID ${DATA_DEVICE_UUID}!"; exit 1
fi
if [ ! -e "${DATA}" ]
then
mkdir -p ${DATA}
fi
if [ ! -e "${DATA}/video" ]
then
mkdir -p "${DATA}/video"
fi
# sort files
mkdir -p "${DATA}/daily"
for i in `find ${DATA}/data/ -name "${DATE}*.jpg"`
do
if [ ! -e "${DATA}/daily/`basename ${i}`" ]
then
ln ${i} "${DATA}/daily"
fi
done

@ -0,0 +1,41 @@
#!/bin/bash
DATA_DEVICE_UUID="C6CE6C2BCE6C1649"
MOUNT_PATH="/mnt/extern"
DATA="${MOUNT_PATH}/timelapse"
CLIENT="timelapse@192.168.111.2"
CLIENT_FOLDER="/timelapse"
mountpoint -q ${MOUNT_PATH}
if [ ${?} != 0 ]
then
sudo mount --uuid ${DATA_DEVICE_UUID} -o uid=1000,gid=1000,umask=0022 ${MOUNT_PATH} || echo "Cannot mount data device with UUID ${DATA_DEVICE_UUID}!"; exit 1
fi
if [ ! -e "${DATA}" ]
then
mkdir -p ${DATA}
fi
if [ ! -e "${DATA}/in" ]
then
mkdir -p "${DATA}/in"
fi
rsync -q -a --remove-source-files "${CLIENT}:${CLIENT_FOLDER}/*.jpg" "${DATA}/in"
if [ ! -e "${DATA}/data" ]
then
mkdir -p "${DATA}/data"
fi
for i in `find "${DATA}/in/" -name "*.jpg" -type f`
do
if [ `stat -c%s ${i} ` -gt 0 ]
then
#convert -quiet ${i} -resize 1080 "${DATA}/data/`basename ${i}`"
daystring=`basename ${i} | cut -d"_" -f1 | sed 's/\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)-\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\3\.\2\.\1 \4:\5/'`
convert -quiet ${i} -resize 1080 -gravity SouthEast -pointsize 22 -fill white -annotate +30+30 "${daystring}" "${DATA}/data/`basename ${i}`"
fi
rm "${i}"
done

@ -0,0 +1,49 @@
#!/bin/bash
DATA_DEVICE_UUID="C6CE6C2BCE6C1649"
MOUNT_PATH="/mnt/extern"
DATA="${MOUNT_PATH}/timelapse"
CLIENT="timelapse@192.168.111.2"
CLIENT_FOLDER="/timelapse"
set -x
if [[ "${1}" =~ [01]*[0-9] ]]
then
MONTH=${1}
else
MONTH=`date --date="1 month ago" +%m`
fi
YEAR=`date --date="1 month ago" +%Y`
mountpoint -q ${MOUNT_PATH}
if [ ${?} != 0 ]
then
sudo mount --uuid ${DATA_DEVICE_UUID} -o uid=1000,gid=1000,umask=0022 ${MOUNT_PATH} || echo "Cannot mount data device with UUID ${DATA_DEVICE_UUID}!"; exit 1
fi
if [ ! -e "${DATA}" ]
then
mkdir -p ${DATA}
fi
if [ ! -e "${DATA}/video" ]
then
mkdir -p "${DATA}/video"
fi
# sort files
mkdir -p "${DATA}/monthly"
monthly_counter=0
for i in `find ${DATA}/data/ -name "${YEAR}${MONTH}*.jpg"`
do
monthly_counter=$((monthly_counter + 1))
if [ ${monthly_counter} -ge 30 ]
then
if [ ! -e "${DATA}/monthly/`basename ${i}`" ]
then
ln ${i} "${DATA}/monthly"
fi
monthly_counter=0
fi
done

@ -0,0 +1,47 @@
#!/bin/bash
MOUNT_PATH="/mnt/extern"
DATA="${MOUNT_PATH}/timelapse"
CLIENT_FOLDER="/timelapse"
DATA_FOLDER=""
case ${1} in
daily)
DATA_FOLDER="${1}"
DATE=`date --date="1 day ago" +%Y%m%d`
;;
weekly)
DATA_FOLDER="${1}"
DATE=`date --date="1 week ago" +%Y%m%d`
;;
monthly)
DATA_FOLDER="${1}"
DATE=`date --date="1 month ago" +%Y%m%d`
;;
*)
DATA_FOLDER="yearly"
DATE=`date +%Y%m%d`
;;
esac
mountpoint -q ${MOUNT_PATH}
if [ ${?} != 0 ]
then
sudo mount --uuid ${DATA_DEVICE_UUID} -o uid=1000,gid=1000,umask=0022 ${MOUNT_PATH} || echo "Cannot mount data device with UUID ${DATA_DEVICE_UUID}!"; exit 1
fi
if [ ! -e "${DATA}" ]
then
echo "No directory: ${DATA}"
exit 401
fi
if [ ! -e "${DATA}/video" ]
then
echo "No directory: ${DATA}/video"
exit 402
fi
# sort files
ffmpeg -y -loglevel quiet -framerate 30 -pattern_type glob -i "${DATA}/${DATA_FOLDER}/*.jpg" -vcodec libx265 -crf 20 -vf scale=1920:1080 "${DATA}/video/${DATA_FOLDER}_${DATE}.mp4"

@ -0,0 +1,56 @@
#!/bin/bash
DATA_DEVICE_UUID="C6CE6C2BCE6C1649"
MOUNT_PATH="/mnt/extern"
DATA="${MOUNT_PATH}/timelapse"
CLIENT="timelapse@192.168.111.2"
CLIENT_FOLDER="/timelapse"
if [[ "${1}" =~ [0-9]{2} ]]
then
WEEK=${1}
else
WEEK=`date --date="last monday" +%V`
fi
current_week=`date +'%V'`
current_week_diff=$((${current_week}-${WEEK}))
DATE_WEEK=`date --date="${current_week_diff} weeks ago" +%Y%m%d`
DATE_START=`date --date="${DATE_WEEK}" +%s`
DATE_STOP=$(($DATE_START+7*86400))
mountpoint -q ${MOUNT_PATH}
if [ ${?} != 0 ]
then
sudo mount --uuid ${DATA_DEVICE_UUID} -o uid=1000,gid=1000,umask=0022 ${MOUNT_PATH} || echo "Cannot mount data device with UUID ${DATA_DEVICE_UUID}!"; exit 1
fi
if [ ! -e "${DATA}" ]
then
mkdir -p ${DATA}
fi
if [ ! -e "${DATA}/video" ]
then
mkdir -p "${DATA}/video"
fi
# sort files
rm -rf "${DATA}/weekly"
mkdir -p "${DATA}/weekly"
weekly_counter=0
for i in `find ${DATA}/data/ -name "${DATE}*.jpg"`
do
seconds_unixtime=`echo "${i}" | sed 's/^.\+_\([0-9]\+\).*/\1/'`
if [ "${seconds_unixtime}" -ge "${DATE_START}" ] || [ "${seconds_unixtime}" -lt "${DATE_STOP}" ]
then
weekly_counter=$((weekly_counter + 1))
if [ ${weekly_counter} -ge 7 ]
then
if [ ! -e "${DATA}/weekly/`basename ${i}`" ]
then
ln ${i} "${DATA}/weekly"
fi
weekly_counter=0
fi
fi
done

@ -0,0 +1,46 @@
#!/bin/bash
DATA_DEVICE_UUID="C6CE6C2BCE6C1649"
MOUNT_PATH="/mnt/extern"
DATA="${MOUNT_PATH}/timelapse"
CLIENT="timelapse@192.168.111.2"
CLIENT_FOLDER="/timelapse"
if [[ "${1}" =~ [0-9]{4} ]]
then
YEAR=${1}
else
YEAR=`date --date="1 year ago" +%Y`
fi
mountpoint -q ${MOUNT_PATH}
if [ ${?} != 0 ]
then
sudo mount --uuid ${DATA_DEVICE_UUID} -o uid=1000,gid=1000,umask=0022 ${MOUNT_PATH} || echo "Cannot mount data device with UUID ${DATA_DEVICE_UUID}!"; exit 1
fi
if [ ! -e "${DATA}" ]
then
mkdir -p ${DATA}
fi
if [ ! -e "${DATA}/video" ]
then
mkdir -p "${DATA}/video"
fi
# sort files
mkdir -p "${DATA}/yearly"
yearly_counter=0
for i in `find ${DATA}/data/ -name "${YEAR}*.jpg"`
do
yearly_counter=$((yearly_counter + 1))
if [ ${yearly_counter} -ge 360 ]
then
if [ ! -e "${DATA}/yearly/`basename ${i}`" ]
then
ln ${i} "${DATA}/yearly"
fi
yearly_counter=0
fi
done

@ -0,0 +1,43 @@
#!/bin/bash
#
# Exposure mode options : --exposure
# off,auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks
#
# Flicker avoid mode options : --flicker
# off,auto,50hz,60hz
#
# AWB mode options : --awb
# off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon
#
# Image Effect mode options : --imxfx
# none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon
#
# Metering Mode options : --metering
# average,spot,backlit,matrix
#
# Dynamic Range Compression (DRC) options : --drc
# off,low,med,high
QUALITY=70
MODE=2
AWB="auto"
EXPOSURE="auto"
TIMEOUT=4000
RASPISTILL_OPTIONS="--mode ${MODE} --quality ${QUALITY} --encoding jpg --thumb none --nopreview --awb ${AWB} --exposure ${EXPOSURE} --timeout ${TIMEOUT}"
OUTPUT_DIR="/timelapse"
SNAPSHOT_DELAY=10
while [ 1 ]
do
DATE=`date +%Y%m%d-%H%M%S`
SEC=`date +%s`
TIME_VALUES=`/usr/bin/time -v raspistill -v ${RASPISTILL_OPTIONS} -o "${OUTPUT_DIR}/${DATE}_${SEC}.jpg" 2>&1`
TIME_USED=`echo "${TIME_VALUES}" | grep "wall clock" | sed 's/^.\+\([0-9]\+\):\([0-9]\+\.[0-9]\+\)\s*$/\1:\2/'`
min=`echo ${TIME_USED} | cut -d":" -f1`
sec=`echo ${TIME_USED} | cut -d":" -f2`
sleep=`bc << EOF
${SNAPSHOT_DELAY}-(${min}*60+${sec})-0.1
EOF`
sleep ${sleep}
done
echo "Exiting $0 at `date`"
Loading…
Cancel
Save