A mirror of dcurooms found at https://github.com/theycallmemac/dcurooms
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.

65 lines
1.7 KiB

  1. import datetime
  2. from optparse import OptionParser
  3. from lab_booking import LabBooking
  4. from room_booking import RoomBooking
  5. from lookup import LookUp
  6. from now import Now
  7. import utils
  8. __author__ = "theycallmemac"
  9. __version__ = '2.0.0'
  10. __copyright__ = 'Copyright (c) 2018 theycallmemac'
  11. __license__ = 'GPL-3.0'
  12. def get_lab_credentials():
  13. return utils.get_version_email()
  14. def get_room_credentials():
  15. return utils.get_version_form()
  16. def booking_lab(info):
  17. email, password, your_name, society = get_lab_credentials()
  18. lab = LabBooking(email, password, your_name, society, info[1])
  19. emails, message = lab.draft()
  20. print(message)
  21. conf = lab.confirm()
  22. if conf == "y":
  23. result = lab.send(emails[0], emails[1], message)
  24. else:
  25. "Booking cancelled."
  26. def booking_room(info):
  27. email, number, name, society = get_room_credentials()
  28. room = RoomBooking(email, number, name, society, info[1])
  29. form = room.fill()
  30. conf = room.confirm()
  31. if conf == "y":
  32. result = room.submit(form)
  33. else:
  34. "Booking cancelled."
  35. def lookup_building(rooms, info, options):
  36. lst = utils.get_lst(rooms[0], rooms[1], options)
  37. week, day, hour = info[1]
  38. look = LookUp(week, day, hour)
  39. look.check_args()
  40. look.check_time(info[0])
  41. look.building_option(lst)
  42. def lookup_room(info):
  43. room, week, day, hour = info[1]
  44. look = LookUp(week, day, hour)
  45. look.check_args()
  46. look.check_time(info[0])
  47. look.room_option(room)
  48. def now():
  49. week, day, hour, minute = utils.get_current_time(datetime.datetime.now())
  50. now = Now(week, day, hour, minute)
  51. now.round_it()
  52. now.check_args()
  53. now.check_time(info[0])
  54. lst = utils.get_lst(rooms[0], rooms[1], options)
  55. now.building_option(lst, options)