Library Reserve

Keep a standing reservation for your favorite study room.

Motivation: UCSC is a crowded place, and it can be hard to find a place to do group work on campus.

Step 1: Get a group

The script runs fine enough with one person, but policy states you need at least two to reserve a room.

Step 2: Prepare Emails

This will require some coordination with your group members and a bit of legwork on your end.

 

Create a new alternate email account

This is the account that we’ll mostly be working with. It shouldn’t be associated with the school. I’ll be showing this with a gmail account.

Make an application password

This is needed for the script to interact with your email account.

forwarding+filter.jpg

Setup Forwarding

On the .edu emails that can be used to reserve a room, setup forwarding to the new email address.

This will require your groups coordination, as you may need to walk them through the steps, then have them enter a code that will be sent to your email address.

After that, you need them to set up relevant filters to forward you the confirmation emails.

email address to filter: alerts@mail.libcal.com

liblabel.jpg

Filter the confirmations

on the target email account, set up a filter to label the confirmations being sent by you and your group mates

Label: Library

 Step 3: Prepare your environment


At the very least you’ll need:

Python 3 - https://www.python.org/downloads/

A web driver, Ill be using chrome - https://chromedriver.chromium.org/getting-started

and a place you can set up a cron job on linux or scheduled task on windows.

 Step 4: Fill out the script

You can download or clone it here.

group fill.PNG
 

Add the information about you and your group

This should be a list of strings, and index matters here, so the first email should correspond with the first first name and the first last name. Group name will be the same for all.

 

Email and Webdriver location

You may have your web driver installed elsewhere, but this is pretty straight forward.

Here is where you’ll be using that email and application password that you created earlier.

appfill.PNG
wherelib.PNG

The Where

What room do you want reserved and where is it?
You’ll need to get the link to the library booking page and paste it in.

You will also be deciding on which room you want. Each room on the booking site has a name and capacity which you will need to copy and paste exactly to match the format shown.

timesets.PNG

The When

This will be specific to your wants and your room.
Some libraries are only open during certain times, and this even changes day to day, so be sure to check ahead of time or you might squander some of your slots.

You can only reserve 4 hours per .edu email address. Change the lists as needed to match the times you want.
Ensure that you have the same number of items in times_sets as you do .edu addresses.

 Step 5: Let it run

Bookings open up at midnight, one week ahead, so that’s when the script should be running.


Since my groups were on campus everyday, I had mine set to run every night.

If you’re on windows, here is how to set up your task scheduler. If you’re on linux, you don’t need my help.

task1.PNG

Create a new basic task

task2.PNG

set for daily

at midnight

task4.PNG

to run a program

task5a.PNG

python3 the-location-of-the-script/reserve_room.py

task finish.PNG

finish.

 Notes

There are some quirks in the system that you’ll want to watch out for.

TA’s, Professors and the like can usually reserve a room/time slot for an entire quarter ahead of time, so you may need to change rooms at the start of each term.

The script runs well enough, but slows down with a large backlog of emails. I set the alternate email address to automatically delete emails that were over a week old.

Its a webdriver script, so you’ll actually get to watch it work.