Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Movie Ratings Rpt Voting Support Scripts

3 views
Skip to first unread message

Colin Needham

unread,
Sep 7, 1990, 8:17:10 AM9/7/90
to
NEW VERSION OF MOVIE RATINGS VOTING SUPPORT SCRIPTS
===================================================

oli...@athena.mit.edu (James D. Oliver III) writes:
> In article <42...@trantor.harris-atd.com>, ch...@trantor.harris-atd.com (Chuck Musciano) writes:
> |> The top ten contributors to the poll are currently:
>
> [list deleted]
>
> Wow. I had no idea that a) I'd seen that many movies, b) I'd submitted so
> many votes and c) I'd be this far up on any tabulation of number of votes.
>
> I have to put a *big* plug in now for Col Needham's script for making and
> submitting ballots, and keeping track of which ones you've already voted
> for. I was too lazy to wade through all the flicks until he posted it.
> Since then I've used it to submit all my ballots: there've only been three
> of them, and the first one (the biggest one) was about a month ago.
>
> So if I can get this many votes in in less than a month, just think of what
> it could do for you! (Smiles, holds up box with "Col's Super Script"
> written on it as music swells. Fade out.)


It looks like now is a good time to publish the latest release of the voting
support scripts. The new versions convert the ballots to lowercase. This is
to avoid the problem of previously voted movies not being removed due to
case differences. The tabulator is not case sensitive so the modification
shouldn't cause any problems.


NOTES FOR USERS OF THE PREVIOUS RELEASE
=======================================

If you are using the previous versions, you should convert your 'votelog'
file to lowercase using the following commands:

cp votelog votelog.ori
tr [A-Z] [a-z] < votelog.ori > votelog

Once you are sure this has worked, 'votelog.ori' can be deleted.

You should do this before running the 'wkballot' script on this weeks ballot,
as I forgot to convert my UK TV ballot to the usual format (all words beginning
with a capital). The new release will eliminate this and similar problems.


INSTRUCTIONS FOR NEW USERS
==========================

At the end of this message I've included a shell archive containing
three Bourne shell scripts to make the task of voting for movies
easier. The functionality provided is :

* convert a ratings report into a massive ballot

* mail a completed ballot to the tabulator, keeping a log of
the films voted for

* scan one of the weekly ballots (as provided by Chuck) and
automatically remove films you have already voted for.

Please feel free to distribute them and let me know if you have
and modifications.

The scripts are very simple but they do save a considerable amount
of time in scanning through the weekly ballot. The first script
should hopefully encourage new voters to join in, providing the
a ready formatted ballot for over 2,600 movies! Don't forget that
you can also add other movies not yet on the report to the end
of the list.

Customization
-------------

I have tried to make the scripts flexible. The following variables
may be altered to suit your needs :

ballot = name of results file containing the ballot (initial
setting = 'ballot')
votelog = record of previous votes (inital setting = 'votelog')

Descriptions
------------

fullballot generates a ballot containing every movie a ratings report.

Usage: fullballot <movie-ratings-report>

To use this script, simply save this weeks report in a file and
enter the command :

fullballot file

If you have a record of any votes that you have sent in previously,
concatentate the files together and place them in the votelog file.
This file should then be converted to lowercase as outlined
in the "Notes For Users Of The Previous Release" section above.
Any movies in this file will automatically removed from the ballot
produced by the script. Note that to keep the scripts simple the movie
name must begin in the tenth character position. This is the same format
as Chuck publishes the weekly ballot.


wkballot reads in one of Chuck's weekly ballots and removes all the
movies you have already voted for.

Usage: wkballot <weekly-ballot>


mailballot sends a ballot file generated with one of the above scripts to
the tabulator and updates the votelog file. For reasons outlined above,
please ensure that the movie title begins at the 10th character position
on each line.

Usage: mailballot <ballot-file>


EXAMPLE
=======

1. Create a suitable subdirectory, move to the directory and unpack the shell
archive below.

2. Go into notes/news and save this weeks ratings report in file 'rate'
and this weeks ballot in file 'votes'

3. Enter 'fullballot rate'. This will produce a file called ballot in your
subdirectory. Edit ballot, inserting a number between 1 and 10 for the
movies you want to vote for and delete the other movies. Note that you
should use your editor in overwrite mode to keep the movie titles in the
correct column.

4. Enter 'mailballot ballot'. This will mail your votes to the tabulator and
create a vote log for future use.

5. Enter 'wkballot votes'. This will remove from the ballot all the movies
you have voted for in step 3. Edit the ballot file and insert your votes
as before.

6. Enter 'mailballot ballot'. This will mail your votes to the tabulator and
add the record of your votes to the vote log.

7. Repeat steps 5 and 6 on each weekly ballot posted by Chuck.


Hope you find this useful,

Cheers,

Col

------------------------------------------------------------
"Look at it this way, in a hundred years who's gonna care ?"
-- The Terminator
------------------------------------------------------------
Col Needham | Phone: +44 272 799910 x 24131
HP Labs | c...@hplb.hpl.hp.com
Bristol | c...@hplabs.hpl.hp.com
U.K. | c...@otter.hpl.hp.com
------------------------------------------------------------

#---------------------------------- cut here ----------------------------------
# This is a shell archive. Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by Colin Needham <cn@otter> on Fri Sep 7 07:09:14 1990
#
# This archive contains:
# fullballot wkballot mailballot
#
# Error checking via wc(1) will be performed.

LANG=""; export LANG
PATH=/bin:/usr/bin:$PATH; export PATH

echo x - fullballot
cat >fullballot <<'@EOF'
#!/bin/sh
#
# Author: Col Needham c...@otter.hpl.hp.com
#
# Usage: fullballot <latest-movie-ratings-report>
#
# Generate ballot for all movies in ratings report not previously voted for
#

voted=/tmp/voted.$$ # temporary file, contains names of previously voted movies
movies=/tmp/movies.$$ # temporary file, contains names of movies on the report
votelog=votelog # file containing record of previous voting
ballot=ballot # results file, will contain a ballot for all the movies
mrr=$1


# check movie ratings argument supplied
if [ $# -ne 1 ]
then
echo "fullballot: usage fullballot <movie-ratings-report>" >&2
exit 1
fi

# now check its readable
if [ ! -r $mrr ]
then
echo "fullballot: $mrr not readable" >&2
exit 1
fi

# extract names of previously voted movies
if [ -r $votelog ]
then
awk '/^vote / {print substr($0,10,70)}' $votelog | tr [A-Z] [a-z] | sort -u > $voted
else
# no previous votes, create empty voted file
: > $voted
fi

# extract names of movies on ratings report
awk '/ [0-9.*]+ +[0-9]+ +[0-9.]+ */ {print substr($0,33,70)}' < $mrr | tr [A-Z] [a-z] | sort -u > $movies

# find all movies on report and not in voted file, and add "vote"
comm -23 $movies $voted | awk '{print "vote " $0}' > $ballot

# delete temporary files
rm $voted $movies

#output completion message
echo "ballot based on $mrr placed in file $ballot"
@EOF
set `wc -lwc <fullballot`
if test $1$2$3 != 502251392
then
echo ERROR: wc results of fullballot are $* should be 50 225 1392
fi

chmod 751 fullballot

echo x - wkballot
cat >wkballot <<'@EOF'
#!/bin/sh
#
# Usage: wkballot <ballot-file>
#
# Author: Col Needham c...@otter.hpl.hp.com
#
# Removes all the movies previously voted for from a weekly ballot

voted=/tmp/voted.$$ # temporary file, contains names of previously voted movies
balmov=/tmp/balmov.$$ # temporary file, contains names of movies on the report
votelog=votelog # file containing record of previous voting
ballot=ballot # results file, will contain a ballot for all the movies
weeklyballot=$1

# check ballot argument supplied
if [ $# -ne 1 ]
then
echo "wkballot: usage wkballot <ballot-file>" >&2
exit 1
fi

# now check its readable
if [ ! -r $weeklyballot ]
then
echo "wkballot: $weeklyballot not readable" >&2
exit 1
fi

# extract names of previously voted movies
if [ -r $votelog ]
then
awk '/^vote / {print substr($0,10,70)}' $votelog | sort -u > $voted
else
# no previous votes, create empty voted file
: > $voted
fi

# extract names of movies on ballot
awk '/^vote / {print substr($0,10,70)}' $weeklyballot | tr [A-Z] [a-z] | sort -u > $balmov

# find all movies on report and not in voted file, and add "vote"
comm -23 $balmov $voted | awk '{print "vote " $0}' > $ballot

# delete temporary files
rm $voted $balmov

# output completion message
echo "ballot based on $weeklyballot placed in file $ballot"
@EOF
set `wc -lwc <wkballot`
if test $1$2$3 != 482141333
then
echo ERROR: wc results of wkballot are $* should be 48 214 1333
fi

chmod 751 wkballot

echo x - mailballot
cat >mailballot <<'@EOF'
#!/bin/sh
#
# Author: Col Needham c...@otter.hpl.hp.com
#
# Usage: mailballot <ballot-file>
#
# Sends a ballot file to the vote tabulator and adds vote details
# to the vote log file

votelog=votelog # file containing record of previous voting
tabulator=mov...@trantor.harris-atd.com # internet address of tabulator
ballot=$1

# check ballot argument supplied
if [ $# -ne 1 ]
then
echo "mailballot: usage mailballot <ballot-file>" >&2
exit 1
fi

# now check its readable
if [ ! -r $ballot ]
then
echo "mailballot: $ballot not readable" >&2
exit 1
fi

# mail file to tabulator
mailx -s "Movie Ratings" $tabulator < $ballot
echo "votes sent to $tabulator"

# append votes and a blank line to the vote log
echo | cat $ballot - >> $votelog
@EOF
set `wc -lwc <mailballot`
if test $1$2$3 != 33124760
then
echo ERROR: wc results of mailballot are $* should be 33 124 760
fi

chmod 751 mailballot

exit 0

0 new messages