|
|
@ -1,4 +1,4 @@
|
|
|
|
#!/bin/sh
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
# This script parses SIS for a CSV file of a specific room and saves it
|
|
|
|
# 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
|
|
|
|
# in the working directory. The correct room ID is parsed first followed
|
|
|
@ -13,10 +13,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
# All utilities used: curl, sed, grep, tr, iconv
|
|
|
|
# All utilities used: curl, sed, grep, tr, iconv
|
|
|
|
|
|
|
|
|
|
|
|
ROOM_NAME=$(hostname | sed "s/.*-//" | tr "[:lower:]" "[:upper:]")
|
|
|
|
#ROOM_NAME=$(hostname | sed "s/.*-//" | tr "[:lower:]" "[:upper:]")
|
|
|
|
|
|
|
|
ROOM_NAME=$(echo rzv-r013h | 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 "\"")
|
|
|
|
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"
|
|
|
|
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
|
|
|
|
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
|
|
|
|
iconv -f WINDOWS-1250 -t UTF-8 $ROOM_NAME.csv -o $ROOM_NAME.csv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DATE=$(date -d "tomorrow" "+%-d.%-m.%Y" )
|
|
|
|
|
|
|
|
FILE="$ROOM_NAME"".csv"
|
|
|
|
|
|
|
|
TODAY=$(grep "$DATE" "$FILE")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "$TODAY"
|
|
|
|
|
|
|
|
while read line
|
|
|
|
|
|
|
|
do
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LECTURE=$(echo $line | cut -d';' -f 4)
|
|
|
|
|
|
|
|
START=$(date -d "today 0 +$(echo $line | cut -d';' -f 7) minutes" "+%T")
|
|
|
|
|
|
|
|
DURRATION=$(echo $line | cut -d';' -f 9)
|
|
|
|
|
|
|
|
END=$(date -d "$START $DURRATION minutes" "+%T")
|
|
|
|
|
|
|
|
TEACHER=$(echo $line | cut -d';' -f 10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "$LECTURE; $START; $END; $TEACHER"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
done <<< "$TODAY"
|
|
|
|