projects
/
scripts.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added ionice when available.
[scripts.git]
/
archivepics.sh
diff --git
a/archivepics.sh
b/archivepics.sh
index
d96db4e
..
d6a1742
100755
(executable)
--- a/
archivepics.sh
+++ b/
archivepics.sh
@@
-24,14
+24,22
@@
# accompanying JPG for the MOV)
# (3) Move the JPG and MOV to an archive directory of the form
# accompanying JPG for the MOV)
# (3) Move the JPG and MOV to an archive directory of the form
-# ${
GP
_ARCHIVE_DIR}/year/month, create the directory when necessary.
+# ${
IMAGE
_ARCHIVE_DIR}/year/month, create the directory when necessary.
[[ ${archive_size_min} ]] || archive_size_min=1048576 # 1Mb
[[ ${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
+
+export ARCHIVED_PICS="$@"
+
set -e
set -e
-if [[ ! ${
GP
_ARCHIVE_DIR} ]]; then
- echo "You have to set \$
GP
_ARCHIVE_DIR" >&2
+if [[ ! ${
IMAGE
_ARCHIVE_DIR} ]]; then
+ echo "You have to set \$
IMAGE
_ARCHIVE_DIR" >&2
exit 1
fi
exit 1
fi
@@
-39,9
+47,9
@@
fi
for i in "$@"; do
for i in "$@"; do
- if [[ ! -f ${i/JPG/MOV} ]]; then
+ if [[ ! -f ${i/JPG/MOV} ]]
&& [[ ! -f ${i/JPG/3gp} ]]
; then
- if [[ $(stat --printf=%s
$i
) -lt ${archive_size_min} ]]; then
+ if [[ $(stat --printf=%s
"$i"
) -lt ${archive_size_min} ]]; then
echo "Image $i is too small."
exit 1
fi
echo "Image $i is too small."
exit 1
fi
@@
-54,16
+62,22
@@
done
for i in "$@"; do
for i in "$@"; do
- ref=${i/MOV/JPG}
+ 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
if [[ -f ${ref} ]]; then
- TAG=$(exif --ifd=EXIF -t "Date and Time (original)"
${ref}
| grep Value)
+ 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/")
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
+ touch -t $TIMESTAMP
"$i"
else
echo "No exif tag in $i, can not set the date properly."
fi
else
echo "No exif tag in $i, can not set the date properly."
fi
@@
-81,12
+95,12
@@
done
for i in "$@"; do
for i in "$@"; do
- ARCHIVING_PATH=$(ls -l --time-style=+%Y/%b --format=verbose
$i
| awk '{ print $6 }')
+ ARCHIVING_PATH=$(ls -l --time-style=+%Y/%b --format=verbose
"$i"
| awk '{ print $6 }')
- mkdir -p ${
GP
_ARCHIVE_DIR}/${ARCHIVING_PATH}
+ mkdir -p ${
IMAGE
_ARCHIVE_DIR}/${ARCHIVING_PATH}
- echo "Archiving ${
GP_ARCHIVE_DIR}/${ARCHIVING_PATH}/$(basename $i)"
+ echo "Archiving ${
IMAGE_ARCHIVE_DIR}/${ARCHIVING_PATH}/"$(basename "$i")
- cp -p -i
$i ${GP
_ARCHIVE_DIR}/${ARCHIVING_PATH}
+ cp -p -i
"$i" ${IMAGE
_ARCHIVE_DIR}/${ARCHIVING_PATH}
done
done