diff options
| author | David Phillips <david@sighup.nz> | 2017-05-31 23:36:47 +1200 | 
|---|---|---|
| committer | David Phillips <david@sighup.nz> | 2017-05-31 23:36:47 +1200 | 
| commit | 4c41d64d0bafe211b257b6b0a2021297d4b296ea (patch) | |
| tree | bf221e1439f2a5c2d19ea740c51ecd703ec6ed81 /local | |
| parent | f42d83fa8b20f3d6038d172bb55f467b4561768b (diff) | |
| download | dotfiles-4c41d64d0bafe211b257b6b0a2021297d4b296ea.tar.xz | |
Change currency API
Diffstat (limited to 'local')
| -rwxr-xr-x | local/bin/grab-spot | 4 | 
1 files changed, 3 insertions, 1 deletions
diff --git a/local/bin/grab-spot b/local/bin/grab-spot index eda284e..a4974f4 100755 --- a/local/bin/grab-spot +++ b/local/bin/grab-spot @@ -1,5 +1,7 @@  #!/bin/sh +# Warning: uses a non-existant currency API +  # Grabs a spot price for a currency and stores it in ~/.cache  # Useful to run as a cron job and use its cached output in motds or status  # lines @@ -21,7 +23,7 @@ fi  # 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) +	rate=$(curl -L "https://finance.yahoo.com/d/quotes.csv?e=.csv&f=c4l1&s=$1$2=X" | cut -d ',' -f 2)  	if [ $? -ne 0 ] ; then  		logger "$0: curl error"  		exit  | 
