You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

updatecalcurse 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/usr/bin/env bash
  2. # AUTHOR: shaggy
  3. # FILE: updatecalcurse
  4. # ROLE: TODO (some explanation)
  5. # CREATED: 2014-12-21 18:17:01
  6. # MODIFIED: 2015-05-14 06:47:03
  7. function check {
  8. if (( $(pidof calcurse | wc -w) == 1 )); then
  9. echo -e "Calcurse is already Running... Killing"
  10. kill $(pidof calcurse | awk '{print $1}')
  11. else
  12. echo -e "Calcurse is Not Running... Safe to Continue"
  13. fi
  14. }
  15. function checkif {
  16. case "$(pidof calcurse | wc -w)" in
  17. 0) echo "Calcurse not open, Proceding:"
  18. ;;
  19. 2) echo "Calcurse running, all OK"
  20. ;;
  21. *) echo "Instances of Calcurse running. Stopping..."
  22. kill $(pidof calcurse | awk '{print $1}')
  23. ;;
  24. esac
  25. }
  26. function loading {
  27. char="|"
  28. while :; do
  29. case "$char" in
  30. "|")
  31. char="/"
  32. ;;
  33. "/")
  34. char="-"
  35. ;;
  36. "-")
  37. char="\\"
  38. ;;
  39. "\\")
  40. char="|"
  41. ;;
  42. esac
  43. sleep .2s
  44. echo -en "\rLoading $char"
  45. done
  46. }
  47. checkif
  48. loading &
  49. pid=$!
  50. echo -e "\nDownloading Calendars"
  51. rm ~/.calcurse/apts &&
  52. touch ~/.calcurse/apts &&
  53. wget http://followshows.com/ical/agDBZ7tj -q -O ~/.calcurse/tv.ics &&
  54. wget http://animecalendar.net/user/ical/11986/469cc8a1f781cffe56dd993294ad83c8 -q -O ~/.calcurse/anime.ics &&
  55. wget https://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics -q -O ~/.calcurse/usholiday.ics &&
  56. wget https://www.google.com/calendar/ical/en.mexican%23holiday%40group.v.calendar.google.com/public/basic.ics -q -O ~/.calcurse/mexicanholiday.ics &&
  57. wget https://www.google.com/calendar/ical/pfutdblf1gi8jmfsvroh76f6jg%40group.calendar.google.com/public/basic.ics -q -O ~/.calcurse/firstshowingdotnet.ics &&
  58. wget https://www.google.com/calendar/ical/en.japanese%23holiday%40group.v.calendar.google.com/public/basic.ics -q -O ~/.calcurse/japanholiday.ics &&
  59. #wget https://www.google.com/calendar/ical/ht3jlfaac5lfd6263ulfh4tql8%40group.calendar.google.com/public/basic.ics -q -o ~/.calcurse/moon.ics &&
  60. #wget http://otakucalendar.com/ical/releasedates-us.ics -q -O ~/.calcurse/otakucal.ics &&
  61. wget https://www.gamingonlinux.com/calendar_ical.php -q -O ~/.calcurse/gol.ics &&
  62. sleep 2 &&
  63. # do something
  64. echo -e "\nDownloading Complete Begin Importing"
  65. sleep 2s &&
  66. calcurse -i ~/.calcurse/tv.ics &&
  67. calcurse -i ~/.calcurse/gol.ics &&
  68. calcurse -i ~/.calcurse/anime.ics &&
  69. calcurse -i ~/.calcurse/usholiday.ics &&
  70. calcurse -i ~/.calcurse/mexicanholiday.ics &&
  71. calcurse -i ~/.calcurse/firstshowingdotnet.ics &&
  72. calcurse -i ~/.calcurse/japanholiday.ics &&
  73. #calcurse -i ~/.calcurse/otakucal.ics &&
  74. #calcurse -i ~/.calcurse/moon.ics &&
  75. echo -e "\nImporting Local Cal"
  76. mv ~/.calcurse/apts ~/.calcurse/aptstemp &&
  77. cat ~/.calcurse/myapts ~/.calcurse/aptstemp > ~/.calcurse/apts &&
  78. sleep 2s
  79. clear &&
  80. echo -e "\nComplete, opening calcurse..."
  81. clear &&
  82. sleep 1s
  83. kill -9 $pid
  84. wait $pid 2>/dev/null # Supress "Killed" message
  85. echo -en "\r\033[K" # Completely overwrite last line
  86. echo "Done."
  87. #calcurse