From 681facea5ca194fcd334d0f1e4fc7c1959223ba1 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 17 Aug 2005 03:17:23 +0000 Subject: [PATCH] Middle initial removed from CSV; AM/PM in HTML; comments --- perl/schedproc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/perl/schedproc b/perl/schedproc index fbb2737..9107e83 100755 --- a/perl/schedproc +++ b/perl/schedproc @@ -3,8 +3,8 @@ # -*- perl -*- vim: ft=perl sw=4 sts=4 # Brief usage instructions: -# Create a ~/.sct6rc that has SID=yourssn and PIN=yourpin -# You'll need to change the url below if you go anywhere but TAMUK. +# Create a ~/.schedprocrc that has schedule=/path/to/schedule.xml and +# grades=/path/to/grades.xml. HTTP URLs are acceptable use strict; 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); @@ -304,7 +304,9 @@ sub do_csv_schedule { #print "# $id\n"; $current .= $row->{'id'} . ","; $current .= $row->{'title'} . ","; - $current .= '"' . $row->{'instructor'} . '",'; + my $instructor = $row->{'instructor'}; + $instructor =~ s/ [A-Z. ]* / /; + $current .= '"' . $instructor . '",'; $next =~ /^(\d\d\d\d)(\d\d)(\d\d)$/; $current .= $1 . "-". $2 ."-" . $3 . "\n"; print $current; @@ -382,7 +384,6 @@ sub do_html_schedule { print "\n"; foreach my $row (@schedule) { map { s/\n/
/g; $_} %$row; - #$row->{'time'} =~ s/-/-/; $row->{'duration'} =~ s/-/
/g; $row->{'duration'} =~ s/\d\d(\d\d)(\d\d)(\d\d)/$2-$3-$1/g; print ''; @@ -391,15 +392,20 @@ sub do_html_schedule { print '' .$row->{'id'}. '
'; print '' .$row->{'title'}. ''; my $instructor = $row->{'instructor'}; + #$instructor =~ s/ [A-Z. ]* / /; my $email = get_faculty_email($row->{'instructor'}); #if($email) { #print '' #. $row->{'instructor'} . ""; # } else { - print "" . $row->{'instructor'} . ""; + print "" . $instructor . ""; #} print "" . $row->{'days'} . ""; - print "" . $row->{'begin'}."-".$row->{'end'} . ""; + my ($a,$b) = ($row->{'begin'}, $row->{'end'}); + $b .= "AM"; + $a=~s/(1[3-9]|2\d|00):(\d\d)/sprintf "%d:%02d",abs $1-12,$2/e; + $b=~s/(1[3-9]|2\d|00):(\d\d)AM/sprintf "%d:%02dPM",abs $1-12,$2/e; + print "$a-$b"; print "" . $row->{'duration'} . ""; print "" . $row->{'location'} . ""; print "\n"; -- 2.30.2