some very simple helper scripts to work with the api

This commit is contained in:
Ben West
2014-07-13 20:46:54 -07:00
parent e11a6b3162
commit 8300fa0d0a
4 changed files with 115 additions and 2 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
SVG=$1
DIRECTION=$2
AT=$3
OPTS=""
if [ -n "$AT" ]; then
OPTS="--date ${AT}"
fi
ISO=$(date -Iseconds $OPTS)
UNIX=$(date +%s $OPTS)
(
cat <<EOF
{ "svg": $SVG,
"device": "test",
"direction": "$DIRECTION",
"dateString": "$ISO",
"date": "$UNIX"
}
EOF
) | tr -d '\n'
echo
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
INPUT=$1
(
echo '['
first=""
cat $1 | while read dateString date svg direction device ; do
test -n "$first" && printf "," || printf -v first "nope"
./bin/create_svg.sh $svg $direction $dateString
echo
done
echo ']'
) | tr -d '\n' | json