選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

updatecalcurse 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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: 2014-12-22 14:55:56
  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. sleep 2 &&
  57. # do something
  58. echo -e "\nDownloading Complete Begin Importing"
  59. sleep 2s &&
  60. calcurse -i ~/.calcurse/tv.ics &&
  61. calcurse -i ~/.calcurse/anime.ics &&
  62. calcurse -i ~/.calcurse/usholiday.ics &&
  63. echo -e "\nImporting Local Cal"
  64. mv ~/.calcurse/apts ~/.calcurse/aptstemp &&
  65. cat ~/.calcurse/myapts ~/.calcurse/aptstemp > ~/.calcurse/apts &&
  66. sleep 2s
  67. clear &&
  68. echo -e "\nComplete, opening calcurse..."
  69. clear &&
  70. sleep 1s
  71. kill -9 $pid
  72. wait $pid 2>/dev/null # Supress "Killed" message
  73. echo -en "\r\033[K" # Completely overwrite last line
  74. echo "Done."
  75. #calcurse