예제 #1
0
def extractInfo(classInfo,year,semester):
    classInfo = classInfo.split('.0 ')[1]
    className = classInfo.split('\\n')[0]
    if str(className).startswith('Credit'):
        className = str(className).split('Credit ')[1]
    classInfo = classInfo.split('\\n')[-1]
    classLocation = classInfo.split(' -')[0]
    if ' -' in str(classInfo):
        classInfo = classInfo.split(' -')[1]
    elif 'M-' in str(classInfo):
        classInfo = 'M-' + str(classInfo.split('M-')[1])
    classTimes = classInfo
    print classTimes
    if '- ' in classTimes:
        classTime = classTimes.split('- ')[1:]
    '''
    for character in str(classTime):
        print character, character.encode('hex')
    '''
    print classTime
    if '-' in str(classTime):
        classTime = str(classTime).split('-')
    print classTime
    classDays = classInfo.split(' ')[0]
    #classTime = str(classTimes.split(':')[0])+':'+str(classTimes.split(':')[1])+':'+str(classTimes.split(':')[2])
    #print "Class " + str(className) + " meets in " + str(classLocation) + " on the days " + str(classDays) + ' from ' + str(classTime)
    classStartHour,classStartMinute,classEndHour,classEndMinute = extractDaysTimes.extractStartStopTimes(classTime)
    daysWithClass = extractDaysTimes.extractDaysOfWeek(classDays)
    firstMonth,firstDay,lastMonth,lastDay = getDates.findBeginEnd(semester,year) #Send this info to getDates to find when this specific semester starts and ends
예제 #2
0
import extractDaysTimes
import makeCalendar
import getDates
from BeautifulSoup import BeautifulSoup

# We plan to make iCal files Google Calendar can understand

classList = BeautifulSoup(
    open("Class Schedule.html")
)  # Open your download of the printer friendly version of your WebStac class schedule page

semester = classList.find(selected="selected")  # Figure out what semester this schedule is for
fallSpring = semester.contents[0][0:2]  # Semester name is in the first two char FL or SP
classYear = int(semester.contents[0][2:6])  # Year name is the 3rd -> 7th chars (ie 2014)
firstMonth, firstDay, lastMonth, lastDay = getDates.findBeginEnd(
    fallSpring, classYear
)  # Send this info to getDates to find when this specific semester starts and ends

enrolledClasses = []

classesTable = classList.find(
    id="tabSched"
)  # Parse through the HTML table and put information for each class into a list of lists
rows = classesTable.findAll("tr")
for tr in rows:
    cols = tr.findAll("td")
    classInfo = []  # Temporary list of info for each class
    for td in cols:
        for item in td:
            classInfo.append(item.string)
    if classInfo[0] == "Enrolled":  # We only want to add classes we are enrolled in
예제 #3
0
import getDates
from BeautifulSoup import BeautifulSoup
#We plan to make iCal files Google Calendar can understand

classList = BeautifulSoup(
    open('Class Schedule.html')
)  #Open your download of the printer friendly version of your WebStac class schedule page

semester = classList.find(
    selected="selected")  #Figure out what semester this schedule is for
fallSpring = semester.contents[0][
    0:2]  #Semester name is in the first two char FL or SP
classYear = int(
    semester.contents[0][2:6])  #Year name is the 3rd -> 7th chars (ie 2014)
firstMonth, firstDay, lastMonth, lastDay = getDates.findBeginEnd(
    fallSpring, classYear
)  #Send this info to getDates to find when this specific semester starts and ends

enrolledClasses = []

classesTable = classList.find(
    id='tabSched'
)  #Parse through the HTML table and put information for each class into a list of lists
rows = classesTable.findAll('tr')
for tr in rows:
    cols = tr.findAll('td')
    classInfo = []  #Temporary list of info for each class
    for td in cols:
        for item in td:
            classInfo.append(item.string)
    if classInfo[