Created
April 18, 2016 18:40
-
-
Save professorjamesmoriarty/05834a65bf838b843f80042bdf9fc55d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# AUTHOR: shaggy | |
# FILE: updatecalcurse | |
# ROLE: TODO (some explanation) | |
# CREATED: 2014-12-21 18:17:01 | |
# MODIFIED: 2015-08-21 15:59:32 | |
function check { | |
if (( $(pidof calcurse | wc -w) == 1 )); then | |
echo -e "Calcurse is already Running... Killing" | |
kill $(pidof calcurse | awk '{print $1}') | |
else | |
echo -e "Calcurse is Not Running... Safe to Continue" | |
fi | |
} | |
function checkif { | |
case "$(pidof calcurse | wc -w)" in | |
0) echo "Calcurse not open, Proceding:" | |
;; | |
2) echo "Calcurse running, all OK" | |
;; | |
*) echo "Instances of Calcurse running. Stopping..." | |
kill $(pidof calcurse | awk '{print $1}') | |
;; | |
esac | |
} | |
function loading { | |
char="|" | |
while :; do | |
case "$char" in | |
"|") | |
char="/" | |
;; | |
"/") | |
char="-" | |
;; | |
"-") | |
char="\\" | |
;; | |
"\\") | |
char="|" | |
;; | |
esac | |
sleep .2s | |
echo -en "\rLoading $char" | |
done | |
} | |
checkif | |
loading & | |
pid=$! | |
echo -e "Downloading Calendars" | |
rm ~/.calcurse/apts && | |
touch ~/.calcurse/apts && | |
rm ~/.calcurse/*.ics | |
#wget http://otakucalendar.com/ical/releasedates-us.ics -q -O ~/.calcurse/otakucal.ics && | |
#wget https://www.gamingonlinux.com/calendar_ical.php -q -O ~/.calcurse/gol.ics && | |
#sleep 2 && | |
# do something | |
echo -e "\nDownloading Complete Begin Importing" | |
#sleep 2s && | |
calcurse -i ~/.calcurse/firstshowingdotnet.ics >/dev/null 2>&1 && | |
calcurse -i ~/.calcurse/japanholiday.ics >/dev/null 2>&1 && | |
#calcurse -i ~/.calcurse/otakucal.ics && | |
#calcurse -i ~/.calcurse/moon.ics && | |
echo -e "\nImporting Local Cal" | |
mv ~/.calcurse/apts ~/.calcurse/aptstemp && | |
cat ~/.calcurse/myapts ~/.calcurse/aptstemp > ~/.calcurse/apts && | |
#sleep 2s | |
echo -e "\nComplete" | |
#sleep 1s | |
kill -9 $pid | |
wait $pid 2>/dev/null # Supress "Killed" message | |
echo -en "\r\033[K" # Completely overwrite last line | |
#echo "Done." | |
clear | |
#calcurse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment