Tuesday, December 2, 2014

NCAA Football standings.

Varied an existing script to show the NCAA college football standings. It is not formatted yet as I can get what I want without formatting. It is pretty much the same script to get the scores, but using a different web page to gather data.




[code]
###################################
# Score  Grabber
#
#===============================
# Assignments
# --------------------------------
datafile="tcf"
let "flag = 0"
let "year = 2014"
let "week = 14"

if [ "$week" -lt "10" ]; then
    let "a = 0"
fi
# end assignments
#=================================
#
# Get data file
#---------------------------------
elinks -dump "www.ncaa.com/standings/football/fbs/"  > $datafile
IFS='%'
#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
    echo $line | grep -q "Atlantic Coast"
    if  [ $? -eq 0 ]; then
        # header
        clear
        let "flag = 1"
    fi
    if [ $flag -eq 1 ]; then
        echo $line | grep -q "NCAA football"
            if [ $? -eq 0 ]; then
            let "flag = 0"
        else
            echo $line | grep -q "GameCenter"      
            if [ $? -eq 0 ]; then
                let "response = donothing"
            else
            line=`echo $line | sed 's/\[.*\]//'`
            echo $line
        fi
        fi
    fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===================================
# End.
####################################
[/code]
=================================================

For historical sake here is the score grabber and other listings

[code]
 ####################################
# College Score standings
#
#===============================
# Assignments
# --------------------------------
datafile="tcf"
let "flag = 0"
let "year = 2014"
let "week = 14"

if [ "$week" -lt "10" ]; then
    let "a = 0"
fi
# end assignments
#=================================
#
# Get data file
#---------------------------------
elinks -dump "www.ncaa.com/scoreboard/football/fbs/$year/$a$week/"  > $datafile

#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
    echo $line | grep -q "NCAA Scoreboard"
    if  [ $? -eq 0 ]; then
        # header
        clear
        let "flag = 1"
    fi
    if [ $flag -eq 1 ]; then
        echo $line | grep -q "Featured Sections"
            if [ $? -eq 0 ]; then
            let "flag = 0"
        else
            echo $line | grep -q "GameCenter"      
            if [ $? -eq 0 ]; then
                let "response = donothing"
            else
                echo $line | sed 's/\[.*\]//'
            fi
        fi
    fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===================================
# End.
####################################
[/code]

Here is the code for the pro-football script also.

[code]
  ####################################
# Score  Grabber
#
#===============================
# Assignments
# --------------------------------
datafile="nflscorefile"
a=1
flag=0
week=13
# phase 1 is preseason phase 2 is regular season #phase 3 is
phase=2
season=2014
#finished week = 1 unfinished week = 0
weekfinished=1
league="nfl"
# end assignments
#=================================
#
# Get data file
#---------------------------------
case $weekfinished in
1)
elinks "http://sports.yahoo.com/$league/scoreboard/?week=$week&phase=$phase&season=$season"  > $datafile
;;
0)
elinks "http://sports.yahoo.com/$league/scoreboard/"  > $datafile
;;
*)
#
;;
esac
#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
echo $line | grep -q "Home Score Away"
if  [ $? -eq 0 ]; then
# header
clear
echo
echo ------------------------------------------------
echo  $league  data for phase = $phase  week = $week  season = $season
echo ------------------------------------------------
echo
echo "       Home           Score              Away"
echo ""
let "flag = 1"
fi
if [ $flag -eq 1 ]; then
echo $line | grep -q "Latest NFL Videos"
if [ $? -eq 0 ]; then
let "flag = 0"
else
echo $line | grep -q "Home Score Away"
if  [ $? -ne 0 ]; then
case $weekfinished in
1)
echo $line | sed 's/\[.*\]//'
;;
0)
echo $line
;;
*)
#
;;
esac
fi
fi
fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===============================
# End.
################################


[/code]
###################################
# Nfl Standings Grabber
#
#===============================
# Assignments
# --------------------------------
datafile="tcf"
let "flag = 0"
let "year = 2014"
let "week = 14"

if [ "$week" -lt "10" ]; then
    let "a = 0"
fi
# end assignments
#=================================
#
# Get data file
#---------------------------------
elinks -dump "http://www.nfl.com/standings"  > $datafile
IFS='%'
#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
    echo $line | grep -q "American Football Conference"
    if  [ $? -eq 0 ]; then
        # header
        clear
        let "flag = 1"
    fi
    if [ $flag -eq 1 ]; then
        echo $line | grep -q "NFL Playoff Picture"
            if [ $? -eq 0 ]; then
            let "flag = 0"
        else
            echo $line | grep -q "GameCenter"     
            if [ $? -eq 0 ]; then
                let "response = donothing"
            else
            line=`echo $line | sed 's/\[.*\]//'`
            echo $line
        fi
        fi
    fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===================================
# End.
####################################
[code]

[/code]

No comments:

Post a Comment