From 4c41d64d0bafe211b257b6b0a2021297d4b296ea Mon Sep 17 00:00:00 2001 From: David Phillips Date: Wed, 31 May 2017 23:36:47 +1200 Subject: Change currency API --- local/bin/grab-spot | 4 +++- zshrc | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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 diff --git a/zshrc b/zshrc index 3756c7b..4d121c8 100644 --- a/zshrc +++ b/zshrc @@ -54,6 +54,7 @@ RPROMPT='[%?] %w %t' source /usr/share/git/completion/git-prompt.sh source ~/.environment source ~/.aliases +source ~/.aliases.zsh echo Running $(uname) $(uname -r) on $(uname -n) \($(uname -m)\) -- cgit v1.1