2
# $Id: cddb,v 1.3 2004/02/06 00:31:05 ianb-guest Exp $
3
# elvis: cddb -- Search for cd track listings in CDDB (www.gracenote.com)
4
# ianb@nessie.mcc.ac.uk 20030124
10
defyn SURFRAW_cddb_artists 0
11
defyn SURFRAW_cddb_albums 0
12
defyn SURFRAW_cddb_songs 0
13
defyn SURFRAW_cddb_all 0
15
SURFRAW_cddb_default=1
20
Usage: $w3_argv0 [options] [search words]...
22
Surfraw search CDDB (www.gracenote.com) for cd track listings
24
-artists Search artists
25
Environment: SURFRAW_cddb_artists
27
Environment: SURFRAW_cddb_songs
29
Environment: SURFRAW_cddb_songs
31
Environment: SURFRAW_cddb_all
32
Default: search artists and albums
37
w3_parse_option_hook () {
41
-ar*) setopt SURFRAW_cddb_artists 1 ; setopt SURFRAW_cddb_default 0 ;;
42
-alb*) setopt SURFRAW_cddb_albums 1 ; setopt SURFRAW_cddb_default 0 ;;
43
-so*) setopt SURFRAW_cddb_songs 1 ; setopt SURFRAW_cddb_default 0 ;;
44
-all) setopt SURFRAW_cddb_all 1 ; setopt SURFRAW_cddb_default 0 ;;
52
# w3_args now contains a list of arguments
53
if test -z "$w3_args"; then
54
w3_browse_url "http://www.gracenote.com/"
56
escaped_args=`w3_url_of_arg $w3_args`
57
SURFRAW_cddb_queryopts=''
58
if [ $SURFRAW_cddb_albums = 1 -o $SURFRAW_cddb_all -eq 1 -o $SURFRAW_cddb_default -eq 1 ];then
59
SURFRAW_cddb_queryopts="${SURFRAW_cddb_queryopts}f=disc&"
61
if [ $SURFRAW_cddb_artists = 1 -o $SURFRAW_cddb_all -eq 1 -o $SURFRAW_cddb_default -eq 1 ];then
62
SURFRAW_cddb_queryopts="${SURFRAW_cddb_queryopts}f=artist&"
64
if [ $SURFRAW_cddb_songs = 1 -o $SURFRAW_cddb_all -eq 1 ];then
65
SURFRAW_cddb_queryopts="${SURFRAW_cddb_queryopts}f=track&"
68
w3_browse_url "http://www.gracenote.com/music/search.html?${SURFRAW_cddb_queryopts}q=${escaped_args}"