Continuing the cleaning.
authorFrancois Fleuret <francois@fleuret.org>
Sat, 18 May 2013 11:03:54 +0000 (13:03 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Sat, 18 May 2013 11:03:54 +0000 (13:03 +0200)
archivepics.sh [deleted file]

diff --git a/archivepics.sh b/archivepics.sh
deleted file mode 100755 (executable)
index 9c608c1..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/bin/bash
-
-#########################################################################
-# This program is free software: you can redistribute it and/or modify  #
-# it under the terms of the version 3 of the GNU General Public License #
-# as published by the Free Software Foundation.                         #
-#                                                                       #
-# This program is distributed in the hope that it will be useful, but   #
-# WITHOUT ANY WARRANTY; without even the implied warranty of            #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      #
-# General Public License for more details.                              #
-#                                                                       #
-# You should have received a copy of the GNU General Public License     #
-# along with this program. If not, see <http://www.gnu.org/licenses/>.  #
-#                                                                       #
-# Written by and Copyright (C) Francois Fleuret                         #
-# Contact <francois@fleuret.org> for comments & bug reports             #
-#########################################################################
-
-# (1) Check that all JPG are larger than 1M if there is no
-# corresponding MOV
-
-# (2) Change the modification time to match the EXIF info (use the
-# accompanying JPG for the MOV)
-
-# (3) Move the JPG and MOV to an archive directory of the form
-# ${IMAGE_ARCHIVE_DIR}/year/month, create the directory when necessary.
-
-[[ ${archive_size_min} ]] || archive_size_min=1048576 # 1Mb
-
-# if [[ -z $* ]] && [[ ${PHO_NOTE_1} ]]; then
-    # echo "$0 ${PHO_NOTE_1}"
-    # $0 ${PHO_NOTE_1}
-    # exit 0
-# fi
-
-MONTHS=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")
-
-export ARCHIVED_PICS="$@"
-
-set -e
-
-if [[ ! ${IMAGE_ARCHIVE_DIR} ]]; then
-    echo "You have to set \$IMAGE_ARCHIVE_DIR" >&2
-    exit 1
-fi
-
-# Checking the image sizes
-
-for i in "$@"; do
-
-    if [[ ! -f ${i/JPG/MOV} ]] && [[ ! -f ${i/JPG/3gp} ]]; then
-
-        if [[ $(stat --printf=%s "$i") -lt ${archive_size_min} ]]; then
-            echo "Image $i is too small."
-            exit 1
-        fi
-
-    fi
-
-done
-
-# Setting the file modification date according to the exif tag
-
-for i in "$@"; do
-
-    base=${i/%.???/}
-
-    if [[ -f ${base}.JPG ]]; then ref=${base}.JPG; fi
-    if [[ -f ${base}.jpg ]]; then ref=${base}.jpg; fi
-    if [[ -f ${base}.jpeg ]]; then ref=${base}.jpeg; fi
-
-    # echo "ref=${ref}"
-
-    if [[ -f ${ref} ]]; then
-
-        echo "Checking ${ref} date"
-
-        TAG_VALUE=$(exiv2 -P nv "${ref}" 2>/dev/null | grep ^DateTimeOriginal | \
-            sed -e "s/^[^ ]* *\([0-9]*\):\([0-9]*\):\([0-9]*\) *\([0-9]*\):\([0-9]*\):\([0-9]*\).*$/\1\2\3\4\5.\6/")
-
-        if [[ "${TAG_VALUE}" ]]; then
-            touch -t ${TAG_VALUE} "$i"
-        else
-            echo "No exif tag in $i, can not set the date properly."
-        fi
-
-        # TAG=$(exif --ifd=EXIF -t "Date and Time (original)" "${ref}" | grep Value)
-
-        # if [[ ${TAG} ]]; then
-            # TIMESTAMP=$(echo ${TAG} | sed -e \
-                # "s/^ *Value: *\([0-9]*\):\([0-9]*\):\([0-9]*\) *\([0-9]*\):\([0-9]*\):\([0-9]*\).*$/\1\2\3\4\5.\6/")
-            # touch -t $TIMESTAMP "$i"
-        # else
-            # echo "No exif tag in $i, can not set the date properly."
-        # fi
-
-    else
-
-        timestamp=($(basename $i | sed -e "s/^VID_\([0-9][0-9][0-9][0-9]\)\([0-9][0-9]\)\([0-9][0-9]\)_\([0-9][0-9]\)\([0-9][0-9]\)\([0-9][0-9]\).*$/\1\2\3\4\5.\6/"))
-
-        if [[ "${timestamp}" ]]; then
-            echo "Setting time of $i to ${timestamp}"
-            touch -t ${timestamp} "$i"
-        else
-            echo "Can not guess date for $i."
-        fi
-
-    fi
-
-done
-
-# Moving the file to the proper archive directory, which is created
-# first when needed
-
-LOG_ARCHIVING=archive_$(date +%Y_%m_%d_%H:%M:%S).log
-
-for i in "$@"; do
-
-    ARCHIVING_PATH=$(ls -l --time-style=+%Y/%b --format=verbose "$i" | awk '{ print $6 }')
-
-    mkdir -p ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH}
-
-    echo "Archiving ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH}/"$(basename "$i")
-
-    cp -p -i "$i" ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH} && \
-        echo "$i -> ${IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH}" >> ${LOG_ARCHIVING}
-
-done