Add NAME_BY_DATE_FIELD_NAME override to name-by-date.sh.
authorW. Trevor King <wking@drexel.edu>
Sat, 10 Sep 2011 13:14:13 +0000 (09:14 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 10 Sep 2011 13:14:13 +0000 (09:14 -0400)
posts/name-by-date/name-by-date.sh

index abfbc4cabfd340a8ee649f440e20422fac2829ef..a4784bca7b8cef38d779f44f4286b3fdecd91987 100755 (executable)
@@ -28,7 +28,10 @@ while [ -n "$1" ]; do
        FILE=$1
        TYPE=$(file "$FILE" | grep JPEG)
        if [ -n "$TYPE" ]; then
-               FIELD_NAME='Date and Time'
+               FIELD_NAME="$NAME_BY_DATE_FIELD_NAME"
+               if [ -z "$FIELD_NAME" ]; then
+                               FIELD_NAME='Date and Time'
+               fi
                ASCII_DATE=$(exif -m -t "$FIELD_NAME" "$FILE")  # 2010:07:02 08:36:20
                if [ $? -ne 0 ]; then  # use similar field, e.g. 'Date and Time (original)'
                        FIELD=$(exif -m "$FILE" | grep "$FIELD_NAME" | head -n1)