Initial commit
commit
eff6f7ad20
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script parses SIS for a CSV file of a specific room and saves it
|
||||
# in the working directory. The correct room ID is parsed first followed
|
||||
# by a given CSV file.
|
||||
|
||||
# The hostname of the computer running this script has to have the name
|
||||
# of a corresponding room after the first hyphen, eg. "rzv-r013h",
|
||||
# where the room name would be "R013H" as defined in SIS.
|
||||
|
||||
# Curl with TLS support needs to be installed as well as iconv for
|
||||
# Windows-1250 to UTF-8 encoding conversion.
|
||||
|
||||
# All utilities used: curl, sed, grep, tr, iconv
|
||||
|
||||
ROOM_NAME=$(hostname | sed "s/.*-//" | tr "[:lower:]" "[:upper:]")
|
||||
ROOM_ID=$(curl -s "https://is.cuni.cz/studium/rozvrhng/roz_ucebna_macro.php?skr=2018&sem=2&fak=11410" | sed "s,</a>,\n,g" | grep $ROOM_NAME | grep -oP "ucebna=\K[^ ]+" | tr -d "\"")
|
||||
|
||||
printf "%s\n" "Fetching room $ROOM_NAME with ID $ROOM_ID"
|
||||
curl -s "https://is.cuni.cz/studium/rozvrhng/roz_ucebna_micro.php?ucebna=$ROOM_ID&fak=11410&csv=1" > $ROOM_NAME.csv
|
||||
iconv -f WINDOWS-1250 -t UTF-8 $ROOM_NAME.csv -o $ROOM_NAME.csv
|
||||
|
Reference in New Issue