See the attached script.  It is a bash script and it requires that wget, 
perl and the usual GNU versions of egrep, grep and date are in the path.

This script allows you to maintain a web page that has this format:

http://taxa.epi.umn.edu/DVD_example2.html

Every time you want to add a DVD at the bottom of that table, just go to 
IMDb.com, find the movie there, then do this from your command line:

movie_add URL

where "URL" is the IMDb URL for the movie title, or...

movie_add URL filename

...to add the table row to the file "filename".

I'm using this to keep track of DVDs I own and share with friends.  It can 
also be used instead to keep track of which movies you've seen -- just add 
a each movie to the table and put a short review or rating in the "notes" 
column.

Mike
-------------- next part --------------
#!/bin/bash

# Script name: movie_add
#
# Author: Michael B. Miller http://taxa.epi.umn.edu/~mbmiller/
#
# License: GNU General Public License, Version 3 or later:
# http://www.gnu.org/copyleft/gpl.html
#
# This script is for helping the user to keep track of a DVD
# collection.  You might want to lend some of your DVDs to your
# friends and this will provide you with a nice shareable list and a
# way to add notes to it (e.g., to keep track of who you lent your DVD
# to).  The script takes an Internet Movie Database (IMDb) URL for a
# movie title as input and it uses the IMDb information to add a row
# for that movie at the end of an HTML table.  This makes it easy to
# maintain a page with this format:
#
# http://taxa.epi.umn.edu/DVD_example2.html
#
# You must create the initial lines of the HTML file including the
# beginning of the table for DVD records.  Here is an example of such
# a template file:
#
# http://taxa.epi.umn.edu/DVD_example.html
#
# That file is freely available for you to use and to edit as you please.
# 
# Syntax:
#
# movie_add URL
#
# where "URL" is an IMDb URL for a movie title such as 
# http://www.imdb.com/title/tt0068646/
#
# Every line of the table is represented as three lines in the HTML.
# To add/edit a note to a movie record, just go to the end of its
# third line in the HTML and insert the note near the end between
# "<TD>&nbsp;" and "</TD></TR>".
#
# To go from the empty template "example" file above to the "example2"
# file with three movies listed, I would only have to run these three
# commands and use an editor to at the "note" (assuming that the
# "example" template was set to be my default file --see below):
#
# movie_add http://www.imdb.com/title/tt0116282/
# movie_add http://www.imdb.com/title/tt0075686/
# movie_add http://www.imdb.com/title/tt0088258/
#
# How does this script know which file to change?  This is determined
# by the "export file=" line below.  If you would like to use a
# different default file for keeping track of your DVDs, you must
# change that line.  It is also possible to work with a file other
# than the default file simply by specifying the filename on the
# command line:
#
# movie_add URL filename

export file="$HOME/www/DVD_library/index.html"

if [ "$#" -lt 1 ]; then
   echo ERROR: no arguments were given but $0 requires that either one or two arguments be given
   echo try using this command to get more information:
   echo less $0
else
   export URL="$1"

   if [ "$#" = "2" ]; then
      export file="$2"
   fi

   if [ "$#" -gt 2 ]; then
      echo ERROR: $# arguments were given but $0 requires that either one or two arguments be given
      echo try using this command to get more information:
      echo less $0
   else

# There are two lines of code below.  The first line is wrapped
# for readability.

   wget -q -O - "$URL" | grep -P -A1 '<title>.+</title>|<b>User Rating:</b>' | \
   egrep -v 'meta name|^--|User Rating:' | \
   perl -pe "s#<title>#\n<TR><TD>&nbsp;<a href=\042$URL\042># ; \
   s#</title>#</a>&nbsp;</TD># ; \
   s#<b>([0-9]+.*[0-9]*)/10</b> *#<TD align=center><a href=\042${URL}/ratings\042>\$1</a></TD># ; \
   s#//ratings#/ratings#" >> "$file"

   echo '<TD>&nbsp;'$(date +"%B %e, %Y")'</TD><TD>&nbsp;</TD></TR>' >> "$file"

   fi
fi