From 8be6ac4a4697b735cf4bb55adcec8a34d96b7e44 Mon Sep 17 00:00:00 2001 From: Marcin Wozniak Date: Fri, 31 May 2019 08:56:06 +0200 Subject: [PATCH] Added files --- scope.sh | 3 --- weather.sh | 61 ------------------------------------------------------ 2 files changed, 64 deletions(-) delete mode 100644 scope.sh delete mode 100755 weather.sh diff --git a/scope.sh b/scope.sh deleted file mode 100644 index 6ec239d..0000000 --- a/scope.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Ascii-previews of images: -image/*) - img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;; diff --git a/weather.sh b/weather.sh deleted file mode 100755 index acb8ca4..0000000 --- a/weather.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -get_icon() { - case $1 in - 01d) icon="";; - 01n) icon="";; - 02d) icon="";; - 02n) icon="";; - 03*) icon="";; - 04*) icon="";; - 09d) icon="";; - 09n) icon="";; - 10d) icon="";; - 10n) icon="";; - 11d) icon="";; - 11n) icon="";; - 13d) icon="";; - 13n) icon="";; - 50d) icon="";; - 50n) icon="";; - *) icon=""; - esac - - echo $icon -} - -KEY="df84be600aa0134daae1b173f2ad2238" -CITY="Poznan,PL" -UNITS="metric" -SYMBOL="°C" - -API="https://api.openweathermap.org/data/2.5" - -if [ -n "$CITY" ]; then - if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then - CITY_PARAM="id=$CITY" - else - CITY_PARAM="q=$CITY" - fi - - weather=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS") -else - location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue) - - if [ -n "$location" ]; then - location_lat="$(echo "$location" | jq '.location.lat')" - location_lon="$(echo "$location" | jq '.location.lng')" - - weather=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS") - fi -fi - -if [ -n "$weather" ]; then - weather_desc=$(echo "$weather" | jq -r ".weather[0].description" | sed -r 's/\<./\U&/g') - weather_temp=$(echo "$weather" | jq ".main.temp" | cut -d "." -f 1) - weather_icon=$(echo "$weather" | jq -r ".weather[0].icon") - - #echo "$(get_icon "$weather_icon")" "$weather_desc", "$weather_temp$SYMBOL" - echo "$weather_temp$SYMBOL" -fi -