Update.
authorFrancois Fleuret <francois@fleuret.org>
Thu, 2 May 2013 08:54:34 +0000 (10:54 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Thu, 2 May 2013 08:54:34 +0000 (10:54 +0200)
archivepics.sh
gma.sh
kill-unused-xterms.sh

index a1d3f44..9c608c1 100755 (executable)
@@ -76,16 +76,25 @@ for i in "$@"; do
 
         echo "Checking ${ref} date"
 
-        TAG=$(exif --ifd=EXIF -t "Date and Time (original)" "${ref}" | grep Value)
+        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} ]]; 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"
+        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/"))
diff --git a/gma.sh b/gma.sh
index 6b0c518..d914893 100755 (executable)
--- a/gma.sh
+++ b/gma.sh
 set -e
 
 function usage () {
-    echo "gma.sh [--body] [--keepspam] [--subject|--from|--to|--fromto|--sender] <pattern> [<year>]"
+    echo "gma.sh [--body] [--nospam] [--subject|--from|--to|--fromto|--sender] <pattern> [<year>]"
 }
 
 RESULT_MBOX="/tmp/gma"
+KEEP_SPAM=1
 
 if [[ -z "${MAIL_ARCHIVE_DIR}" ]]; then
     echo "Undefined \$MAIL_ARCHIVE_DIR" >&2
@@ -55,8 +56,8 @@ while [[ $1 ]]; do
             IONICE=""
             ;;
 
-        "--keepspam")
-            KEEP_SPAM=1
+        "--nospam")
+            KEEP_SPAM=0
             ;;
 
         "--from")
@@ -113,7 +114,7 @@ echo "Looking for ${RE_PREFIX}${PATTERN}"
 echo "        in ${FILE_PATTERN}"
 echo "        writing result in ${RESULT_MBOX}"
 
-if [[ ${KEEP_SPAM} ]]; then
+if [[ ${KEEP_SPAM} == "1" ]]; then
 
     ${IONICE} cat ${FILE_PATTERN} \
         | pv -s ${SIZE} -p -t -e - \
index 6ea3058..21258ba 100755 (executable)
@@ -28,7 +28,7 @@ SHELL_NAME=bash
 for ppid in $(ps h -C xterm -o pid); do
     N=0
     for pid in $(ps h --ppid $ppid -o pid,cmd | awk '{ if($2 == "'${SHELL_NAME}'") { print $1 }}'); do
-        K=$(ps h --ppid $pid -o cmd,pid | wc -l)
+        K=$(ps h --ppid $pid -o pid | wc -l)
         N=$((N+K+1))
     done
     if [[ $N == 1 ]]; then