Revert "Now moonphase is correct and even more precise (#637)"

This reverts commit 4dbff2873d.
This commit is contained in:
Luke Smith 2020-05-16 10:29:28 -04:00
parent 21a29cca4c
commit a00e42e292
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -5,25 +5,33 @@
moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
{ curl -sf 'https://www.timeanddate.com/moon/phases/' | grep -m1 -o cur-moon-percent.......................................................................................................................................................... > "$moonfile" || exit 1 ;} { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;}
mnphs=$( cat $moonfile | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.') icon="$(cat "$moonfile")"
prcnt=$( cat $moonfile | grep -o "[0-9.0-9]*%" | grep -o "[0-9.0-9]*" )
case "$mnphs" in case "$icon" in
"New") icon="🌑" prcnt="0" ;; 🌑) name="New" ;;
"Waxing Crescent") icon="🌒" ;; 🌒) name="Waxing Crescent" ;;
"First Quarter") icon="🌓" prcnt="50" ;; 🌓) name="First Quarter" ;;
"Waxing Gibbous") icon="🌔" ;; 🌔) name="Waxing Gibbous" ;;
"Full") icon="🌕" prcnt="100" ;; 🌕) name="Full" ;;
"Waning Gibbous") icon="🌖" ;; 🌖) name="Waning Gibbous" ;;
"Last Quarter") icon="🌗" prcnt="50" ;; 🌗) name="Last Quarter" ;;
"Waning Crescent") icon="🌘" ;; 🌘) name="Waning Crescent" ;;
*) echo exit 1 ;; *) exit 1 ;;
esac esac
echo ""$icon" "$prcnt"%" echo "${icon-?}"
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
3) notify-send "🌜 Moon phase module" "$icon: $mnphs $prcnt" ;; 3) notify-send "🌜 Moon phase module" "Displays current moon phase.
- 🌑: New
- 🌒: Waxing Crescent
- 🌓: First Quarter
- 🌔: Waxing Gibbous
- 🌕: Full
- 🌖: Waning Gibbous
- 🌗: Last Quarter
- 🌘: Waning Crescent" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac