Skip to content

johanneslopponen/study-room-finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Study Room Finder -- Find available rooms at Ångströmlaboratoriet

ångan_v2.py is a command-line tool that finds available study rooms at Ångströmlaboratoriet (Uppsala University) by querying live booking data from TimeEdit.

Requirements

pip install icalendar

Usage

python ångan_v2.py <dag> <tid> <längd>
python ångan_v2.py nu <längd>
Argument Description
dag Which day to search. See Day formats below.
tid Start time. See Time formats below. Omitted when using nu.
längd How long you need the room. See Duration formats below.

Examples

# Find rooms free today from 10:00 for 2 hours
python ångan_v2.py idag 10:00 2t

# Find rooms free right now for 2 hours
python ångan_v2.py nu 2t

# Find rooms free tomorrow from 13:00 for 1h30m
python ångan_v2.py imorgon 13:00 1t30m

# Find rooms free next Monday from 08:15 for 45 minutes
python ångan_v2.py måndag 08:15 45m

# Find rooms free on a specific date from 14:00 for 3 hours
python ångan_v2.py 2026-03-12 14:00 3t

# Short time format -- "10" is interpreted as 10:00
python ångan_v2.py onsdag 10 2t

Sample output

Hämtar bokningar från TimeEdit...
Hämtade 2371 bokningar för 102 rum.

  Söker lediga rum: onsdag 2026-03-11 kl 10:00–12:00 (2t)

  Lokal   Namn               Ledigt till
  ──────  ─────────────────  ────────────
  100155  Theatrum Visuale   resten av dagen
  100173  Samtalsrum         resten av dagen
  101121  Sonja Lyttkens     resten av dagen
  101127                     13:15
  90105   Bokningsbar studieyta  14:00
  95101   Celsiusrummet      resten av dagen

  55 lediga rum hittades.

Day formats

The dag argument accepts Swedish, English, and date literals:

Format Examples Description
Relative (Swedish) idag, imorgon, imorrn, övermorgon Today, tomorrow, etc.
Relative (English) today, tomorrow English equivalents
Now nu, now Today at the current time (omit tid argument)
Weekday (Swedish) måndag, mån, tisdag, tis, onsdag, ons, torsdag, tor/tors, fredag, fre, lördag, lör, söndag, sön Next occurrence of that weekday (or today if it matches)
Weekday (English) monday, mon, tuesday, tue, wednesday, wed, thursday, thu, friday, fri, saturday, sat, sunday, sun English equivalents
ISO date 2026-03-12 Specific date
DD/MM 15/3, 03/12 Day/month, assumes current (or next) year

Time formats

Format Examples Description
HH:MM 10:00, 08:15, 13:30 Hours and minutes
H 10, 8 Interpreted as HH:00

When using nu/now, the time argument is omitted and the current clock time is used instead.

Duration formats

Format Examples Description
Hours 2t, 2h Swedish t or English h
Minutes 90m, 45min
Combined 1t30m, 2h15m Hours and minutes
Decimal 1.5t, 1,5h Fractional hours
H:MM 1:30 Hours:minutes
Plain number 90 Interpreted as minutes

How it works

The script fetches live iCal feeds from Uppsala University's TimeEdit system. Two feeds are used:

  1. Primary feed -- Contains schedules for all tracked rooms (lectures, seminars, student bookings, meetings, etc.)
  2. Supplementary feed -- Contains additional bookings with "Planerad" (planned) status that may not appear in the primary feed.

The set of known rooms is derived from the iCal data itself: every room that appears in any event's LOCATION field is tracked. A room is considered free if it has no overlapping bookings during the requested time window.

Events that appear in both feeds (same UID) are deduplicated to avoid double-counting.

Sub-room handling

Some rooms are split into sub-rooms (e.g., 101136 has sub-rooms 101136-A and 101136-B). A booking on the main room blocks all sub-rooms, and a booking on a sub-room blocks the main room.

Updating iCal URLs

The iCal URLs are defined in the ICAL_URLS list at the top of the script. TimeEdit links have a server-side limit of 1000 objects per query. If a URL returns a 500 error, the date range or number of rooms needs to be reduced when generating the link on TimeEdit.

The script handles URL failures gracefully -- if one feed fails, it continues with the others and prints a warning.

About

Command line tool for finding available rooms at Ångströmlaboratoriet by queriying TimeEdit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages