~ubuntu-branches/ubuntu/trusty/surfraw/trusty-proposed

« back to all changes in this revision

Viewing changes to elvi/cddb

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Smith
  • Date: 2005-04-20 17:00:59 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050420170059-z7j6h1rsqfgfwhmg
Tags: 2.1.0-1
* Ian Beckwith <ianb@nessie.mcc.ac.uk>:
  + New elvi: dmoz, w3html, w3link, w3css, w3rdf.
  + New elvi: rae (by Ruben Pollan <meskio@terra.es>).
  + surfraw.IN:w3_url_escape: escaped `(' and `)'.
  + Fixed elvi (Thanks to Justin B. Rye):
      - sunsolve  (Closes: #289502).
      - altavista (Closes: #289503).
  + deblists: Updated list of debian mailing lists.
  + currency: Now a proper elvis.
  + Added appendix 2 to HACKING on preparing a release.
* Moritz Muehlenhoff <jmm@inutil.org>:
  + Switch rhymes search from Lycos to Rhymezone (by Justin B Rye)
    (Closes: #289498)
  + Fix BBC News search (by Justin B Rye) (Closes: #289499)
  + New elvi by by Justin B Rye (Closes: #290032)
    - cia      Search for CIA documents
    - deblogs  Debian changelogs
    - etym     Search for word origins
    - foldoc   Free online dictionary of computing
  + New cve elvis for CAN assignment searches
  + Rewrite debian/copyright properly

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
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
 
5
 
 
6
. surfraw || exit 1
 
7
 
 
8
w3_config_hook () {
 
9
        # options
 
10
        defyn SURFRAW_cddb_artists 0
 
11
        defyn SURFRAW_cddb_albums 0
 
12
        defyn SURFRAW_cddb_songs 0
 
13
        defyn SURFRAW_cddb_all 0
 
14
        # internal
 
15
        SURFRAW_cddb_default=1 
 
16
}
 
17
 
 
18
w3_usage_hook () {
 
19
    cat <<EOF
 
20
Usage: $w3_argv0 [options] [search words]...
 
21
Description:
 
22
  Surfraw search CDDB (www.gracenote.com) for cd track listings
 
23
Local options:
 
24
  -artists                      Search artists
 
25
                                Environment: SURFRAW_cddb_artists
 
26
  -albums                       Search albums
 
27
                                Environment: SURFRAW_cddb_songs
 
28
  -songs                        Search songs
 
29
                                Environment: SURFRAW_cddb_songs
 
30
  -all                          Search all three
 
31
                                Environment: SURFRAW_cddb_all
 
32
                                Default: search artists and albums
 
33
EOF
 
34
    w3_global_usage
 
35
}
 
36
 
 
37
w3_parse_option_hook () {
 
38
    opt="$1"
 
39
    optarg="$2"
 
40
    case "$opt" in
 
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 ;; 
 
45
        *) return 1 ;;
 
46
    esac
 
47
    return 0
 
48
}
 
49
 
 
50
w3_config
 
51
w3_parse_args "$@"
 
52
# w3_args now contains a list of arguments
 
53
if test -z "$w3_args"; then
 
54
    w3_browse_url "http://www.gracenote.com/"
 
55
else
 
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&"
 
60
        fi
 
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&"
 
63
        fi
 
64
        if [ $SURFRAW_cddb_songs = 1 -o $SURFRAW_cddb_all -eq 1 ];then
 
65
                SURFRAW_cddb_queryopts="${SURFRAW_cddb_queryopts}f=track&"
 
66
        fi
 
67
                
 
68
    w3_browse_url "http://www.gracenote.com/music/search.html?${SURFRAW_cddb_queryopts}q=${escaped_args}"
 
69
fi