Created
May 6, 2016 00:49
-
-
Save professorjamesmoriarty/58beaca33a02ac8fbf0e2a6f067e1747 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 -q http://www.kouzos.com/ical/Movies.ics -O ~/.calcurse/movies.ics | |
wget -q http://www.kouzos.com/ical/DVD.ics -O ~/.calcurse/dvds.ics | |
# do something | |
echo -e "\nDownloading Complete Begin Importing" | |
#sleep 2s && | |
calcurse -i ~/.calcurse/dvds.ics >/dev/null 2>&1 && | |
calcurse -i ~/.calcurse/movies.ics >/dev/null 2>&1 && | |
calcurse -i ~/.calcurse/tv.ics >/dev/null 2>&1 && | |
calcurse -i ~/.calcurse/google.ics >/dev/null 2>&1 && | |
#calcurse -i ~/.calcurse/gol.ics >/dev/null 2>&1 && | |
calcurse -i ~/.calcurse/anime.ics >/dev/null 2>&1 && | |
calcurse -i ~/.calcurse/usholiday.ics >/dev/null 2>&1 && | |
calcurse -i ~/.calcurse/mexicanholiday.ics >/dev/null 2>&1 && | |
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