1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#!/bin/sh
# $Id$
# elvis: imdb -- Search the Internet Movie Database (www.imdb.com)
# ianb@erislabs.net 20030209
. surfraw || exit 1
w3_config_hook () {
def SURFRAW_imdb_category all
}
w3_usage_hook () {
cat <<EOF
Usage: $w3_argv0 [options] [search words]...
Description:
Surfraw search the Internet Movie Database (www.imdb.com)
Local options:
-category= Category to search
All |
Titles |
MyMovies |
People |
Characters |
Quotes |
Bios |
Plots
Default: $SURFRAW_imdb_category
Environment: SURFRAW_imdb_category
EOF
w3_global_usage
}
w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
-category=Titles) setopt SURFRAW_imdb_category tt ;;
-category=People) setopt SURFRAW_imdb_category nm ;;
-category=Characters) setopt SURFRAW_imdb_category ch ;;
-category=*) setopt SURFRAW_imdb_category $optarg ;;
*) return 1 ;;
esac
return 0
}
w3_config
w3_parse_args "$@"
# w3_args now contains a list of arguments
if test -z "$w3_args"; then
w3_browse_url "http://www.imdb.com/"
else
escaped_args=`w3_url_of_arg $w3_args`
#Avoids people having to quote "My+Movies" on command line
if [ $SURFRAW_imdb_category = MyMovies ]; then
SURFRAW_imdb_category="My+Movies"
fi
w3_browse_url "http://www.imdb.com/find?s=${SURFRAW_imdb_category}&q=${escaped_args}"
fi
|