clockworkpc

Lecture Schedule Generator for Google Calendar

Mar 8th, 2012
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.14 KB | None | 0 0
  1. #!/usr/bin/python
  2. #/home/cpcmonster/bin/lecture_dates_2012_01.py
  3.  
  4. # Released under a GPLv3 Licence by Clockwork PC 2011
  5. # www.clockworkpc.com.au
  6.  
  7. # You are entitled to the following four freedoms:
  8. # Freedom 0: To run this program for any purpose
  9. # Freedom 1: To study how this program works and change it to make it do what you wish
  10. # Freedom 2: To redistribute copies so you can help your neighbour
  11. # Freedom 3: To distribute copies of your modified version to others
  12.  
  13.  
  14. import os
  15.  
  16. #Subject Details
  17.  
  18. lCode = raw_input("What is the code of this subject? ")
  19. lName = raw_input("What is the name of this subject? ")
  20.  
  21. lTitle = lCode + " " + lName
  22.  
  23. l1Title = lCode + " L1 " + lName
  24. l2Title = lCode + " L2 " + lName
  25.  
  26. lRepeat = "for 12 weeks"
  27.  
  28. print ""
  29. print "This subject is called " + lTitle
  30. print ""
  31.  
  32. #First Lecture Details
  33.  
  34. l1DayInput = input("""What day is the first lecture?
  35.  
  36. 1. Monday
  37. 2. Tuesday
  38. 3. Wednesday
  39. 4. Thursday
  40. 5. Friday
  41. 6. Saturday
  42. 7. Sunday
  43.  
  44. """)
  45.  
  46. if l1DayInput == 1:
  47.     l1Day = "every Monday"
  48. elif l1DayInput == 2:
  49.     l1Day = "every Tuesday"
  50. elif l1DayInput == 3:
  51.     l1Day = "every Wednesday"
  52. elif l1DayInput == 4:
  53.     l1Day = "every Thursday"
  54. elif l1DayInput == 5:
  55.     l1Day = "every Friday"
  56. elif l1DayInput == 6:
  57.     l1Day = "every Saturday"
  58. elif l1DayInput == 7:
  59.     l1Day = "every Sunday"
  60.  
  61. print "The first lecture takes place on " + l1Day
  62.  
  63. l1StartingTime = input("""What is the duration of this lecture?
  64.  
  65. 1. 10:00-12:00
  66. 2. 11:00-13:00
  67. 3. 12:00-14:00
  68. 4. 13:00-15:00
  69. 5. 14:00-16:00
  70. 6. 15:00-17:00
  71. 7. 16:00-18:00
  72. 8. 17:00-19:00
  73. 9. 18:00-20:00
  74.  
  75. """)
  76.  
  77. if l1StartingTime == 1:
  78.     l1Duration = "10:00-12:00"
  79. elif l1StartingTime == 2:
  80.     l1Duration = "11:00-13:00"
  81. elif l1StartingTime == 3:
  82.     l1Duration = "12:00-14:00"
  83. elif l1StartingTime == 4:
  84.     l1Duration = "13:00-15:00"
  85. elif l1StartingTime == 5:
  86.     l1Duration = "14:00-16:00"
  87. elif l1StartingTime == 6:
  88.     l1Duration = "15:00-17:00"
  89. elif l1StartingTime == 7:
  90.     l1Duration = "16:00-18:00"
  91. elif l1StartingTime == 8:
  92.     l1Duration = "17:00-19:00"
  93. elif l1StartingTime == 9:
  94.     l1Duration = "18:00-20:00"
  95. else:
  96.     print "wrong input"
  97.  
  98. l1Location = raw_input("Where is the lecture? ")
  99. l1Theatre = "at " + l1Location
  100.  
  101. l1Schedule = l1Title + " " + l1Theatre + " " + l1Duration + " " + lRepeat + " " + l1Day
  102.  
  103. print ""
  104. print l1Schedule
  105. print ""
  106.  
  107. #Second Lecture Details
  108.  
  109. l2DayInput = input("""What day is the second lecture?
  110.  
  111. 1. Monday
  112. 2. Tuesday
  113. 3. Wednesday
  114. 4. Thursday
  115. 5. Friday
  116. 6. Saturday
  117. 7. Sunday
  118.  
  119. """)
  120.  
  121. if l2DayInput == 1:
  122.     l2Day = "every Monday"
  123. elif l2DayInput == 2:
  124.     l2Day = "every Tuesday"
  125. elif l2DayInput == 3:
  126.     l2Day = "every Wednesday"
  127. elif l2DayInput == 4:
  128.     l2Day = "every Thursday"
  129. elif l2DayInput == 5:
  130.     l2Day = "every Friday"
  131. elif l2DayInput == 6:
  132.     l2Day = "every Saturday"
  133. elif l2DayInput == 7:
  134.     l2Day = "every Sunday"
  135.  
  136. print ""
  137. print "The second lecture takes place on " + l2Day
  138. print ""
  139.  
  140. l2StartingTime = input("""What is the duration of this lecture?
  141.  
  142. 1. 10:00-12:00
  143. 2. 11:00-13:00
  144. 3. 12:00-14:00
  145. 4. 13:00-15:00
  146. 5. 14:00-16:00
  147. 6. 15:00-17:00
  148. 7. 16:00-18:00
  149. 8. 17:00-19:00
  150. 9. 18:00-20:00
  151.  
  152. """)
  153.  
  154. if l2StartingTime == 1:
  155.     l2Duration = "10:00-12:00"
  156. elif l2StartingTime == 2:
  157.     l2Duration = "11:00-13:00"
  158. elif l2StartingTime == 3:
  159.     l2Duration = "12:00-14:00"
  160. elif l2StartingTime == 4:
  161.     l2Duration = "13:00-15:00"
  162. elif l2StartingTime == 5:
  163.     l2Duration = "14:00-16:00"
  164. elif l2StartingTime == 6:
  165.     l2Duration = "15:00-17:00"
  166. elif l2StartingTime == 7:
  167.     l2Duration = "16:00-18:00"
  168. elif l2StartingTime == 8:
  169.     l2Duration = "17:00-19:00"
  170. elif l2StartingTime == 9:
  171.     l2Duration = "18:00-20:00"
  172. else:
  173.     print "wrong input"
  174.  
  175. l2Location = raw_input("Where is the lecture? ")
  176. l2Theatre = "at " + l2Location
  177.  
  178. l2Schedule = l2Title + " " + l2Theatre + " " + l2Duration + " " + lRepeat + " " + l2Day
  179.  
  180. print ""
  181. print l2Schedule
  182. print ""
  183.  
  184. # Google Calendar Code
  185.  
  186. print ""
  187. print "Google Calendar Code"
  188. print ""
  189. os.system("google calendar add " + '"' + l1Schedule +'"')
  190. os.system("google calendar add " + '"' + l2Schedule +'"')
  191.  
  192. os.system("xcowsay 'Your calendars for " + l1Title + " and " + l2Title + " have been generated :)'")
Add Comment
Please, Sign In to add comment