def check_for_changes():
    """
    change_occured: responsible for the recognition of webuntis changes.

    :return: TRUE, if change in the WebUntis has occured; None if nothing happend;
    """
    # Normally variable 'teachers' will be used instead of 'teacherlist' - just for testing.
    teacherlist = ['HOR']

    for teacher in teacherlist:
        substitutions = WebUntisData.getSubstitutionForSpecificTeacher(teacher)
        numSubstitutions = len(substitutions)
        if numSubstitutions == 0:
            CHANG_OCCURED = False
        elif numSubstitutions > 0:
            CHANG_OCCURED = True
            message = WebUntisData.printSubstitutionForSpecificTeacher(teacher)
            notify(message)
Exemplo n.º 2
0
def fillTables():
    """
    fillTables(): loads timetable in database.
    :return:
    """
    counter=0
    for te in TEACHERS:
        id = WebUntisData.getTeacherID(te)
        print(u"Teacher '"+te+"' with id '"+str(id)+"' :: table created")
        table = WEBUNTIS_SESSION.timetable(teacher=id, start=monday, end=friday).to_table()

        for d in get_timetable_data(table):
            counter+=1
            splitted=d.split(";")
            if len(splitted) is 1:
                break
            insertCMD = "INSERT INTO t_%s(ID, Date, Time, Subject, Class, Room, Substitution) " \
                        "VALUES(%d,'%s','%s','%s','%s','%s','%s');" % (te, counter, splitted[0], splitted[1],splitted[2],splitted[3],splitted[4], "No")
            execute(insertCMD)
Exemplo n.º 3
0
def fillTables():
    """
    fillTables(): loads timetable in database.
    :return:
    """
    counter = 0
    for te in TEACHERS:
        id = WebUntisData.getTeacherID(te)
        print(u"Teacher '" + te + "' with id '" + str(id) +
              "' :: table created")
        table = WEBUNTIS_SESSION.timetable(teacher=id,
                                           start=monday,
                                           end=friday).to_table()

        for d in get_timetable_data(table):
            counter += 1
            splitted = d.split(";")
            if len(splitted) is 1:
                break
            insertCMD = "INSERT INTO t_%s(ID, Date, Time, Subject, Class, Room, Substitution) " \
                        "VALUES(%d,'%s','%s','%s','%s','%s','%s');" % (te, counter, splitted[0], splitted[1],splitted[2],splitted[3],splitted[4], "No")
            execute(insertCMD)
__status__ = "started"
"""

#
# This is a special program. Goal is to successfully display the timetable of our head of department Mr. Hager, as an html table.
# For the beginning. Next a database has to be created, so that the real data can be stored and managed, and later on displayed on
# the EPaper-Display in front of his room.
#

import WebUntis_Session
import WebUntisData
import datetime
import sqlite3

# WebUntis Session opening
WEBUNTIS_SESSION = WebUntisData.getSession()

# List of all teachers of our school (as shortname, f.e. HAG)
TEACHERS = WebUntisData.getTeacher_shortname()

# Specific teacher id [38: HAG]
TEACHER_ID = 38

# newline
EOL = "\n"

# database filename
DATABASE = "headOfDepartment.db"
CONNECTION = sqlite3.connect(DATABASE)

# todays date and monday+friday of the current week
Exemplo n.º 5
0
__status__ = "started"
"""

#
# This is a special program. Goal is to successfully display the timetable of our head of department Mr. Hager, as an html table.
# For the beginning. Next a database has to be created, so that the real data can be stored and managed, and later on displayed on
# the EPaper-Display in front of his room.
#

import WebUntis_Session
import WebUntisData
import datetime
import sqlite3

# WebUntis Session opening
WEBUNTIS_SESSION = WebUntisData.getSession()

# List of all teachers of our school (as shortname, f.e. HAG)
TEACHERS = WebUntisData.getTeacher_shortname()

# Specific teacher id [38: HAG]
TEACHER_ID = 38

# newline
EOL = "\n"

# database filename
DATABASE = "headOfDepartment.db"
CONNECTION = sqlite3.connect(DATABASE)

# todays date and monday+friday of the current week
__status__ = "(More or less) Finished."
"""

#
# This program is responsible for the automatic WebUnits Change Notifications.
#

import smtplib
import secret
import WebUntisData
import logging
import os
from datetime import datetime

# WebUntis Session opening
WEBUNTIS_SESSION = WebUntisData.getSession()

# teacher email-addresses
teachers = WebUntisData.getTeacher_shortname()

# Sender Email-Adress
sender = secret.gmail_sender

# Receiver
receivers = ['*****@*****.**',  '*****@*****.**']
#copyReceivers = ['*****@*****.**', '*****@*****.**']

# message content
message = ""

# email suffix
Exemplo n.º 7
0
#
# This is just a testing-file and is not a relevant script of our diploma project.
#

import WebUntis_Session
import WebUntisData
import datetime
import json
import re

session = WebUntis_Session.open_session()
id = 365

#WebUntisData.printClasses()
#printDepartments()
#printRooms()
#printSubjects()
print(WebUntisData.getTeacherID("BRE"))
#printSchoolyears()
#printSubstitutions()
#printTimetable(id)
#print(getSubstitutions())
#print(WebUntisData.getClasses())
#WebUntisData.printAllSubstitutions()
#x = WebUntisData.getSubstitutionForSpecificTeacher("KOR")

#print(WebUntisData.printSubstitutionForSpecificTeacher("KOR"))
#WebUntisData.printAllSubstitutions()
#WebUntisData.checkForSubstitutions()

WebUntis_Session.close_session(session)
Exemplo n.º 8
0
#
# This is just a testing-file and is not a relevant script of our diploma project.
#

import WebUntis_Session
import WebUntisData
import datetime
import json
import re

session = WebUntis_Session.open_session()
id = 365

#WebUntisData.printClasses()
#printDepartments()
#printRooms()
#printSubjects()
print(WebUntisData.getTeacherID("BRE"))
#printSchoolyears()
#printSubstitutions()
#printTimetable(id)
#print(getSubstitutions())
#print(WebUntisData.getClasses())
#WebUntisData.printAllSubstitutions()
#x = WebUntisData.getSubstitutionForSpecificTeacher("KOR")

#print(WebUntisData.printSubstitutionForSpecificTeacher("KOR"))
#WebUntisData.printAllSubstitutions()
#WebUntisData.checkForSubstitutions()

WebUntis_Session.close_session(session)