]>
permondes.de Git - Pictureviewer2.git/blob - SoPi
e15bbebbe1ffa0c35b8e0196f3d8cda14c9c787c
2 # Sort pictures by date
4 # filename list working file
8 # echo usage: SoPi picturedirectory
12 FN_List
="SoPiList.out"
13 EXIF_List
="SoPiEXIF.out"
14 Sorted_EXIF_List
="SoPiEXIFS.out"
15 PictureList
="PictureList.txt"
16 Pic_PATH
=${1:-"Fotos"}"/"
20 # make sure file PictureList does not exist! To avoid overwriting existing data
21 if [ -s "$PictureList" ]
23 echo ***Error
: File
$PictureList already exists
27 # List all pictures in the current directory and sub-directories
29 find "$Pic_PATH" -type f
> "$FN_List"
31 # read this file and add EXIF data
32 echo Finding EXIF data...
35 # grep the line that contains the date the picture was taken, ignore error messages
36 #### EXIF_Value=`exif -t DateTimeOriginal "$filename" 2>/dev/null | grep -H --label="$filename" Value`
37 EXIF_Value
=`exiv2 -g Exif.Photo.DateTimeOriginal -Pv print "$filename" 2>/dev/null`
38 # stat uses "-" in the date, exiv2 ":"
39 EXIF_Value
=`echo $EXIF_Value | sed -e {s/:/-/} -e {s/:/-/}`
40 # if no picture date available use last modification date of file
41 if [ -z "$EXIF_Value" ]
43 EXIF_Value
=`stat --printf="%y" "$filename"`
45 echo -e \""$filename"\" \"$EXIF_Value\" >> $EXIF_List
48 # sort by date, ignore separation characters in date (":" for EXIF, "-" for stat)
49 echo Sorting filenames by
date, then filename...
50 sort --field-separator=" " --key=2 -d -o $Sorted_EXIF_List $EXIF_List
52 echo Creating
file $PictureList ...
53 echo 'var pictureString = (` \' > "$PictureList"
54 mawk -F\" '{printf "<figure><img src=\"%s\" /><figcaption>%s</figcaption></figure>\n", $2, $4}' $Sorted_EXIF_List >> "$PictureList"
55 echo '`);' >> "$PictureList"
60 rm -f $Sorted_EXIF_List