From f8f974f175f964a6f147e72299a1898c50bfce50 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 20 Apr 2017 18:03:53 +1200 Subject: Make currency more extensible --- local/bin/grab-spot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'local/bin/grab-spot') diff --git a/local/bin/grab-spot b/local/bin/grab-spot index 989d037..d912d7a 100755 --- a/local/bin/grab-spot +++ b/local/bin/grab-spot @@ -8,7 +8,7 @@ # for example, to get the value of USD in NZD: # grab-spot USD NZD # would place a file at ~/.cache/USDNZD containing the value of the USD in NZD, -# to 4 decimal places +# to 4 decimal places, and a label for the conversion if [ -z $1 ]; then logger "$0: blank FROM currency" @@ -19,8 +19,8 @@ if [ -z $2 ]; then exit fi -# Only bother downloading if it's more than 3 hours old -if ([ ! -f ~/.cache/"$1$2" ] || [ $(find ~/.cache/"$1$2" -mmin +60) ]) ; then +# Only bother downloading if it's more than 1 hour old +if ([ ! -f ~/.cache/currency/"$1$2" ] || [ $(find ~/.cache/currency/"$1$2" -mmin +60) ]) ; then rate=$(curl "http://rate-exchange-1.appspot.com/currency?from=$1&to=$2" | jshon -e rate) if [ $? -ne 0 ] ; then logger "$0: curl error" -- cgit v1.1