diff --git a/www/pict-converter.sh b/www/pict-converter.sh index d0f92c0..04ae98a 100755 --- a/www/pict-converter.sh +++ b/www/pict-converter.sh @@ -45,23 +45,33 @@ function convert { rsync -r tmp_videos/ public_html/videos/ echo "metadata export" + l=0 + for pict in public_html/pictures/*.jpg; do + l=$((l+1)) + done f=0 - echo -e '{' > tmp_metadata/frames.json echo -e '\t"frames":[' >> tmp_metadata/frames.json + for pict in public_html/pictures/*.jpg; do # SRC src="${pict/public_html\/pictures\//}" # TIME # time="${pict/public_html\/pictures\/hehe-/}" # time="${time/.jpg/}" - time=`exiftool 2>/dev/null -S --DateTimeOriginal -p '$DateTimeOriginal' -d %Y-%m-%dT%T "$pict"` + datetime=`exiftool 2>/dev/null -S --DateTimeOriginal -p '$DateTimeOriginal' -d %Y-%m-%dT%T "$pict"` # GPS gps=`exiftool 2>/dev/null -n -p '$GPSLatitude,$GPSLongitude' $pict` # FRAME - frame=$(((60/$vf)*$f)) - echo -e "\t\t{\"src\":\"$src\", \"time\":\"$time\", \"gps\":\"$gps\", \"frame\":\"$frame\"}," >> tmp_metadata/frames.json + currenttime=$(((1/$pf)*$f)) + + if [[ $f == $(($l-1)) ]]; then + echo -e "\t\t{\"src\":\"$src\", \"datetime\":\"$datetime\", \"gps\":\"$gps\", \"currenttime\":\"$currenttime\"}" >> tmp_metadata/frames.json + else + echo -e "\t\t{\"src\":\"$src\", \"datetime\":\"$datetime\", \"gps\":\"$gps\", \"currenttime\":\"$currenttime\"}," >> tmp_metadata/frames.json + fi + f=$(($f+1)) done