use strict;
use LWP::UserAgent;
use HTML::TableExtract;
-#use Time::Local;
use Date::Calc::Object qw(Day_of_Week Decode_Day_of_Week Decode_Month Week_of_Year Monday_of_Week Day_of_Week_Abbreviation Delta_Days Add_Delta_Days Nth_Weekday_of_Month_Year Gmtime Mktime);
use Date::Calendar::Profiles qw($Profiles);
use Date::Calendar::Year;
$response = $ua->get("${url}bwskflib.P_SelDefTerm"); # Valid terms
die $response->status_line unless $response->is_success;
-my @terms = grep {s/^<option value="([^"]*)">.*/$1/i} (split( /\r?\n/, $response->content));
+my @terms = grep {s/^<option value="([^"]*)">.*/$1/i} (split( /\r?\n/, $response->content)); # "
die "Site down. Try again later.\n" unless (@terms);
sub generate_id {
sub get_schedule_terms {
my (@sterms, @a);
- @a=('10','20','30','40'); # XXX 10 is fall, others are speculation
+ @a=('10','20','30','40'); # Fall, Spring, Summer I, Summer II
+ # Last 3 are currently guesses
my @localtime=localtime();
if ($localtime[4]<3) { # Through Mar 31
@sterms=((1900+$localtime[5]).$a[1]);
my @readheaders = ("Type", "Time", "Days", "Where", "Date Range", "Schedule Type", "Instructors");
my @class;
my $te = new HTML::TableExtract( headers => [ @readheaders ] );
- #@readheaders = ("Course", "Days\xa0TimeLocation", "Session and Dates", "Instructor", "Credit", "CallNumber", "GradeType", "Message");
- my $tf = new HTML::TableExtract( headers => [ @readheaders ] );
my (@schedule, @terms, $classid, $title, $begin, $end, $times, $days, $session);
@terms = get_schedule_terms();
foreach (@_ ? @_ : @terms) {
next unless $l =~ s/.*<CAPTION class=[^>]*>(.* - .... \d\d\d\d \d\d\d)<\/caption>.*/$1/i;
push @class, $l;
}
- #$tf->parse($response->content);
- #print $response->content;
}
foreach my $ts ($te->table_states) {
foreach my $row ($ts->rows) {
location => $row->[3],
#message => $row->[10],
};
- #print join (" ", values %{$schedule[$#schedule]}), "\n";
}
}
return @schedule;
print "</table>\n";
}
-sub do_faculty {
- my @readheaders = ("Name", "College", "Email");
- my $te = new HTML::TableExtract( headers => [ @readheaders ] );
- foreach(qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)) {
- my $response = $ua->get("http://$domain/fs/".$_."dir.htm");
- die $response->status_line unless $response->is_success;
- $te->parse($response->content);
- }
- foreach my $ts ($te->table_states) {
- foreach my $row ($ts->rows) {
- map { s/[\r\n]//g; $_} @$row;
- $row->[0] = capitalize($row->[0]);
- $row->[0] =~ s/([A-Z]r?)$/$1./;
- print '"'.$row->[0].'",',$row->[2].',', $row->[1], "\n";
- }
- }
-}
-
sub do_transcripts {
$response = $ua->get("$url&tserve_tip_write=||WID|SID|PIN&tserve_trans_config=rtranscr.cfg&CareerReqNum=1");
foreach (split /\n/, $response->content) {
}
if ($arg eq "-g") {
+ die "Grade support currently broken.\n";
do_html_grades(@ARGV);
} elsif ($arg eq "-s") {
do_html_schedule(@ARGV);
} elsif ($arg eq "-v") {
do_vcalendar_schedule(@ARGV);
} elsif ($arg eq "-t") {
+ die "Transcript support currently broken.\n";
do_transcripts;
-} elsif ($arg eq "-f") {
- do_faculty;
}
$ua->get("${url}twbkwbis.P_Logout"); # Logout