fixed the last line coma bug on frames.json export

This commit is contained in:
Bachir Soussi Chiadmi
2016-07-01 00:52:45 +02:00
parent c3f1f7ea47
commit 1e40e2f233
+14 -4
View File
@@ -45,23 +45,33 @@ function convert {
rsync -r tmp_videos/ public_html/videos/ rsync -r tmp_videos/ public_html/videos/
echo "metadata export" echo "metadata export"
l=0
for pict in public_html/pictures/*.jpg; do
l=$((l+1))
done
f=0 f=0
echo -e '{' > tmp_metadata/frames.json echo -e '{' > tmp_metadata/frames.json
echo -e '\t"frames":[' >> tmp_metadata/frames.json echo -e '\t"frames":[' >> tmp_metadata/frames.json
for pict in public_html/pictures/*.jpg; do for pict in public_html/pictures/*.jpg; do
# SRC # SRC
src="${pict/public_html\/pictures\//}" src="${pict/public_html\/pictures\//}"
# TIME # TIME
# time="${pict/public_html\/pictures\/hehe-/}" # time="${pict/public_html\/pictures\/hehe-/}"
# time="${time/.jpg/}" # 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
gps=`exiftool 2>/dev/null -n -p '$GPSLatitude,$GPSLongitude' $pict` gps=`exiftool 2>/dev/null -n -p '$GPSLatitude,$GPSLongitude' $pict`
# FRAME # FRAME
frame=$(((60/$vf)*$f)) currenttime=$(((1/$pf)*$f))
echo -e "\t\t{\"src\":\"$src\", \"time\":\"$time\", \"gps\":\"$gps\", \"frame\":\"$frame\"}," >> tmp_metadata/frames.json
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)) f=$(($f+1))
done done