Explorar el Código

add business and health science buildings

master
James McDermott hace 2 años
padre
commit
190bb5792a
Se han modificado 4 ficheros con 20 adiciones y 8 borrados
  1. +12
    -4
      scripts/main.py
  2. +1
    -1
      scripts/now.py
  3. +2
    -2
      scripts/opts.py
  4. +5
    -1
      scripts/utils.py

+ 12
- 4
scripts/main.py Ver fichero

@@ -46,6 +46,12 @@ def setup_options():
parser.add_option(
"-C", "--grattan", action="store_true",
help="displays the status of rooms in the Henry Grattan building")
parser.add_option(
"-H", "--nursing", action="store_true",
help="displays the status of rooms in the Nursing building")
parser.add_option(
"-Q", "--business", action="store_true",
help="displays the status of rooms in the Business building")
return parser


@@ -63,15 +69,17 @@ def get_data():
c = ['LG25', 'LG26', 'LG27', 'L101', 'L114', 'L125', 'L128']
g = ['CG01', 'CG02', 'CG03', 'CG04', 'CG05', 'CG06', 'CG11',
'CG12', 'CG20', 'CG68', 'CG86', 'C166']
q = ["QG21", "QG22", "Q121", "Q122"]
h = ["HG20", "HG22", "HG23"]
details = sys.argv[2:]
return times, c, g, details
return times, c, g, q, h, details


def required():
parser = setup_options()
(options, arguments) = parser.parse_args()
times, c, g, details = get_data()
return parser, (options, arguments), (c, g), (times, details)
times, c, g, q, h, details = get_data()
return parser, (options, arguments), (c, g, q, h), (times, details)


def booking(options, info):
@@ -82,7 +90,7 @@ def booking(options, info):


def lookup(options, rooms, info):
if options.lookup and (options.grattan or options.computing):
if options.lookup and (options.grattan or options.computing or options.nursing or options.business):
opts.lookup_building(rooms, info, options)
elif options.lookup:
opts.lookup_room(info)


+ 1
- 1
scripts/now.py Ver fichero

@@ -55,7 +55,7 @@ class Now(object):
self.minute = '00'

def check_time(self, times):
time = self.hour + self.minute
time = "0" + self.hour + self.minute
if time not in times:
print("\033[1;93m{0}\033[00m".format(
"Outside scheduled timetables. Please try again at 08:00."))


+ 2
- 2
scripts/opts.py Ver fichero

@@ -46,7 +46,7 @@ def booking_room(info):


def lookup_building(rooms, info, options):
lst = utils.get_lst(rooms[0], rooms[1], options)
lst = utils.get_lst(rooms[0], rooms[1], rooms[2], rooms[3], options)
week, day, hour = info[1]
look = LookUp(week, day, hour)
utils.check_args(week, day)
@@ -68,5 +68,5 @@ def now(rooms, info, options):
now.round_it()
utils.check_args(week, day)
now.check_time(info[0])
lst = utils.get_lst(rooms[0], rooms[1], options)
lst = utils.get_lst(rooms[0], rooms[1], rooms[2], rooms[3], options)
now.building_option(lst, options)

+ 5
- 1
scripts/utils.py Ver fichero

@@ -40,11 +40,15 @@ def check_room(timetable_url):
str(tr[14].getText().strip())


def get_lst(c, g, options):
def get_lst(c, g, q, h, options):
if options.computing:
lst = c
elif options.grattan:
lst = g
elif options.business:
lst = q
elif options.nursing:
lst = h
return lst




Cargando…
Cancelar
Guardar