diff options
author | terminaldweller <thabogre@gmail.com> | 2023-03-10 10:53:48 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2023-03-10 10:53:48 +0000 |
commit | e9a4f9e81a55e8ba5264e6b2b524dc74bf4ec8e8 (patch) | |
tree | d4c7a67e38e4fa2e3a3aba26df1d82e97f1d319d /tmux/vcs_info.sh | |
parent | update (diff) | |
download | scripts-e9a4f9e81a55e8ba5264e6b2b524dc74bf4ec8e8.tar.gz scripts-e9a4f9e81a55e8ba5264e6b2b524dc74bf4ec8e8.zip |
updates
Diffstat (limited to 'tmux/vcs_info.sh')
-rwxr-xr-x | tmux/vcs_info.sh | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index 673c07e..88c9e92 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -73,29 +73,34 @@ function get_eth_price { # eth_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price") # cake_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price") # monero_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price") - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_ETH ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_ETH) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if ETH_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price"); then - echo "${ETH_OUTPUT}" > ${PRICE_CACHE_OUTPUT_ETH} + if ETH_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price"); then + if [ -n "${ETH_OUTPUT}" ]; then + echo "${ETH_OUTPUT}" >${PRICE_CACHE_OUTPUT_ETH} + fi fi fi - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_CAKE ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_CAKE) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if CAKE_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price"); then - echo "${CAKE_OUTPUT}" > ${PRICE_CACHE_OUTPUT_CAKE} + if CAKE_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price"); then + if [ -n "${CAKE_OUTPUT}" ]; then + echo "${CAKE_OUTPUT}" >${PRICE_CACHE_OUTPUT_CAKE} + fi fi fi - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_XMR ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_XMR) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if XMR_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price"); then - echo "${XMR_OUTPUT}" > ${PRICE_CACHE_OUTPUT_XMR} + if XMR_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price"); then + if [ -n "${XMR_OUTPUT}" ]; then + echo "${XMR_OUTPUT}" >${PRICE_CACHE_OUTPUT_XMR} + fi fi fi - result="$(cat ${PRICE_CACHE_OUTPUT_ETH})"/"$(cat ${PRICE_CACHE_OUTPUT_CAKE})"/"$(cat ${PRICE_CACHE_OUTPUT_XMR})" echo "${result}" } |