mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
some very simple helper scripts to work with the api
This commit is contained in:
Executable
+23
@@ -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
|
||||
Executable
+15
@@ -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
|
||||
Reference in New Issue
Block a user