/usr/lib/surfraw/freedb is in surfraw 2.2.9-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | #!/bin/sh
# $Id$
# elvis: freedb -- Search for cd track listings in FreeDB (www.freedb.org)
# ianb@erislabs.net 20030129
# notes at end of script
. surfraw || exit 1
w3_config_hook () {
# options
defyn SURFRAW_freedb_artists 0
defyn SURFRAW_freedb_albums 0
defyn SURFRAW_freedb_songs 0
defyn SURFRAW_freedb_rest 0
defyn SURFRAW_freedb_all 0
defyn SURFRAW_freedb_id 0
defyn SURFRAW_freedb_allfields 0
defyn SURFRAW_freedb_allcats 1
defyn SURFRAW_freedb_bycat 0
def SURFRAW_freedb_cats ""
def SURFRAW_freedb_page 1
# internal
SURFRAW_freedb_default=1
}
w3_usage_hook () {
cat <<EOF
Usage: $w3_argv0 [options] [search words]...
Description:
Surfraw search FreeDB (www.freedb.org) for cd track listings
Local options:
-artists Search artists
Environment: SURFRAW_cddb_artists
-albums Search albums
Environment: SURFRAW_cddb_albums
-songs Search songs
Environment: SURFRAW_cddb_songs
-rest Search the rest of the data
Environment: SURFRAW_cddb_rest
-all Search all fields
Environment: SURFRAW_cddb_all
Default: search artists and albums
-id Search by CDDB ID.
-bycat Sort results by category
-cat=CATEGORY Category to search, repeat as needed
Options:
all
blues
classical
country
data
folk
jazz
misc
newage
reggae
rock
soundtrack
Default: all
-page=PAGENUM Start at page PAGENUM
Default: 1
EOF
w3_global_usage
}
w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
-ar*) setopt SURFRAW_freedb_artists 1;setoptyn SURFRAW_freedb_default 0;;
-alb*) setoptyn SURFRAW_freedb_albums 1;setoptyn SURFRAW_freedb_default 0;;
-so*) setoptyn SURFRAW_freedb_songs 1;setoptyn SURFRAW_freedb_default 0;;
-r*) setoptyn SURFRAW_freedb_rest 1;setoptyn SURFRAW_freedb_default 0;;
-all) setoptyn SURFRAW_freedb_all 1;setoptyn SURFRAW_freedb_default 0;;
-id) setoptyn SURFRAW_freedb_id 1;;
-pag*=*) setopt SURFRAW_freedb_page $optarg ;;
-bycat) setoptyn SURFRAW_freedb_bycat 1 ;;
-cat*=*) if [ "$optarg" = "all" ]; then
setoptyn SURFRAW_freedb_allcats 1
SURFRAW_freedb_cats=""
else
setoptyn SURFRAW_freedb_allcats 0
SURFRAW_freedb_cats="${SURFRAW_freedb_cats}&cats%5B%5D=$optarg"
fi
;;
*) return 1 ;;
esac
return 0
}
w3_config
# disable requoting, doesn't work with this elvi.
SURFRAW_quote_ifs=0
w3_parse_args "$@"
# w3_args now contains a list of arguments
if test -z "$w3_args"; then
w3_browse_url http://www.freedb.org/
else
escaped_args=`w3_url_of_arg $w3_args`
SURFRAW_freedb_queryopts="page=${SURFRAW_freedb_page}&"
if ifyes SURFRAW_freedb_id; then
w3_browse_url "http://www.freedb.org/freedb_discid_check.php?discid=${escaped_args}&${SURFRAW_freedb_queryopts}"
else
if [ $SURFRAW_freedb_albums -eq 1 -o \
$SURFRAW_freedb_all -eq 1 -o \
$SURFRAW_freedb_default -eq 1 ]
then
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}fields%5B%5D=title&"
fi
if [ $SURFRAW_freedb_artists -eq 1 -o \
$SURFRAW_freedb_all -eq 1 -o \
$SURFRAW_freedb_default -eq 1 ]
then
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}fields%5B%5D=artist&"
fi
if [ $SURFRAW_freedb_songs -eq 1 -o \
$SURFRAW_freedb_all -eq 1 ]
then
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}fields%5B%5D=track&"
fi
if [ $SURFRAW_freedb_rest -eq 1 -o \
$SURFRAW_freedb_all -eq 1 ]
then
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}fields%5B%5D=rest&"
fi
if [ $SURFRAW_freedb_bycat = 1 ]; then
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}grouping=category&"
else
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}grouping=none&"
fi
if [ $SURFRAW_freedb_allcats = 1 ]; then
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}allcats=YES&"
else
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}allcats=NO${SURFRAW_freedb_cats}"
fi
if [ $SURFRAW_freedb_all = 1 ]; then
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}allfields=YES&"
else
SURFRAW_freedb_queryopts="${SURFRAW_freedb_queryopts}allfields=NO&"
fi
w3_browse_url "http://www.freedb.org/freedb_search.php?${SURFRAW_freedb_queryopts}words=${escaped_args}"
fi
fi
#eg: http://www.freedb.org/freedb_search.php?words=swans&allfields=NO&fields=artist&fields=title&fields=track&fields=rest&allcats=NO&cats=blues&cats=classical&cats=country&cats=data&cats=folk&cats=jazz&cats=misc&cats=newage&cats=reggae&cats=rock&cats=soundtrack&grouping=cats
# minimum: http://www.freedb.org/freedb_search.php?words=swans+are+dead&allfields=YES&allcats=YES&grouping=none
# parameters:
#words=search+words (compulsory)
#allfields=YES | NO (compulsory)
#fields=artist | title | track | rest (can be repeated as often as needed)
#allcats=YES | NO (compulsory)
#cats = blues | classical | country | data | folk | jazz | misc | newage |
# reggae | rock | soundtrack (can be repeated as often as needed)
#grouping=cats | none (compulsory)
|