[Surfraw-commits] [SCM] surfraw - a fast unix command line interface to WWW branch, master, updated. surfraw_2-2-5_1-72-g9ef79d1

James Rowe jnrowe at gmail.com
Mon Feb 15 15:06:57 UTC 2010


The following commit has been merged in the master branch:
commit 9ef79d124aa9f21e309a00e358d220d65f3ff2f5
Author: James Rowe <jnrowe at gmail.com>
Date:   Mon Feb 15 15:05:06 2010 +0000

    New elvi: bookfinder, thanks to Ivy Foster.

diff --git a/ChangeLog b/ChangeLog
index d48aec2..15be421 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2010-02-15  James Rowe  <jnrowe at gmail.com>
 
 	* elvi/imdb: Fixes for upstream search changes.  Thanks to Sadako.
+	* New elvi: bookfinder, thanks to Ivy Foster.
 
 2010-02-14  James Rowe  <jnrowe at gmail.com>
 
diff --git a/README b/README
index 2375bae..551bae3 100644
--- a/README
+++ b/README
@@ -162,6 +162,7 @@ aur             -- Search aur.archlinux.org for PKGBUILDS
 austlii         -- Search Australian Law docs (www.austlii.edu.au)
 bing            -- Search the web using Microsoft's Bing (www.bing.com)
 bbcnews         -- Search BBC News (news.bbc.co.uk)
+bookfinder      -- Search for books (www.bookfinder.com)
 bugmenot        -- Bypass compulsory Web registration (www.bugmenot.com)
 cddb            -- Search for cd track listings in CDDB (www.gracenote.com)
 cia             -- Search CIA documents at www.cia.gov
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index 1d49fc5..321f8f9 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -14,6 +14,7 @@ dist_elvi_SCRIPTS	= \
 		  austlii \
 		  bing \
 		  bbcnews \
+		  bookfinder \
 		  bugmenot \
 		  cddb \
 		  cia \
diff --git a/elvi/Makefile.in b/elvi/Makefile.in
index 733bf49..0c71196 100644
--- a/elvi/Makefile.in
+++ b/elvi/Makefile.in
@@ -44,8 +44,8 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 am__dist_elvi_SCRIPTS_DIST = W acronym alioth altavista amazon archpkg \
-	arxiv ask aur austlii bing bbcnews bugmenot cddb cia cite \
-	cliki cnn codesearch comlaw ctan currency cve debbugs \
+	arxiv ask aur austlii bing bbcnews bookfinder bugmenot cddb \
+	cia cite cliki cnn codesearch comlaw ctan currency cve debbugs \
 	debcontents deblists deblogs debpackages debpkghome debpts \
 	debsec debvcsbrowse debwiki deja discogs dmoz ebay etym excite \
 	fast foldoc filesearching finkpkg freebsd freedb freshmeat \
@@ -163,19 +163,19 @@ top_srcdir = @top_srcdir@
 # $Id$
 elvidir = $(ELVIDIR)
 dist_elvi_SCRIPTS = W acronym alioth altavista amazon archpkg arxiv \
-	ask aur austlii bing bbcnews bugmenot cddb cia cite cliki cnn \
-	codesearch comlaw ctan currency cve debbugs debcontents \
-	deblists deblogs debpackages debpkghome debpts debsec \
-	debvcsbrowse debwiki deja discogs dmoz ebay etym excite fast \
-	foldoc filesearching finkpkg freebsd freedb freshmeat fsfdir \
-	gcache genbugs genpkg genportage gutenberg google happypenguin \
-	imdb ixquick javasun scpan slinuxdoc l1sp lastfm leodict lsm \
-	macports mathworld mininova musicbrainz netbsd ntrs openbsd \
-	piratebay pgpkeys port pubmed rae rfc rhyme rpmsearch scholar \
-	scicom slashdot sourceforge springer stockquote sunonesearch \
-	thesaurus translate urban w3css w3html w3link w3rdf wayback \
-	webster wetandwild wikipedia woffle yahoo youtube yubnub \
-	$(am__append_1)
+	ask aur austlii bing bbcnews bookfinder bugmenot cddb cia cite \
+	cliki cnn codesearch comlaw ctan currency cve debbugs \
+	debcontents deblists deblogs debpackages debpkghome debpts \
+	debsec debvcsbrowse debwiki deja discogs dmoz ebay etym excite \
+	fast foldoc filesearching finkpkg freebsd freedb freshmeat \
+	fsfdir gcache genbugs genpkg genportage gutenberg google \
+	happypenguin imdb ixquick javasun scpan slinuxdoc l1sp lastfm \
+	leodict lsm macports mathworld mininova musicbrainz netbsd \
+	ntrs openbsd piratebay pgpkeys port pubmed rae rfc rhyme \
+	rpmsearch scholar scicom slashdot sourceforge springer \
+	stockquote sunonesearch thesaurus translate urban w3css w3html \
+	w3link w3rdf wayback webster wetandwild wikipedia woffle yahoo \
+	youtube yubnub $(am__append_1)
 all: all-am
 
 .SUFFIXES:
diff --git a/elvi/bookfinder b/elvi/bookfinder
new file mode 100755
index 0000000..c762248
--- /dev/null
+++ b/elvi/bookfinder
@@ -0,0 +1,131 @@
+#!/bin/sh
+# $Id$
+# elvis: bookfinder 	-- Search for books using www.bookfinder.com
+. surfraw || exit 1
+
+w3_config_hook () {
+    def   SURFRAW_bookfinder_binding     "any"
+    defyn SURFRAW_bookfinder_classic     0
+    def   SURFRAW_bookfinder_currency    "USD"
+    def   SURFRAW_bookfinder_destination "us"
+    defyn SURFRAW_bookfinder_first       0
+    def   SURFRAW_bookfinder_language    "en"
+    def   SURFRAW_bookfinder_search      "title"
+    defyn SURFRAW_bookfinder_signed      0
+    def   SURFRAW_bookfinder_type        "any"
+}
+
+w3_usage_hook () {
+    cat <<EOF
+Usage: $w3_argv0 [options] [search terms]...
+Description:
+  Surfraw: Search for books using www.bookfinder.com
+Example:
+Local Options:
+  -author="..."                 Search for an author.
+                                Complements -search=title
+  -binding=                     Search for copies with a particular binding
+           any          |       Any
+           hard         |       Hardbacks only
+           soft         |       Softcovers/paperbacks only
+                                Default: $SURFRAW_bookfinder_binding
+                                Environment: SURFRAW_bookfinder_binding
+  -classic                      Use classic search display
+                                Default: no
+                                Environment: SURFRAW_bookfinder_classic
+  -currency=                    Display prices in the given currency
+                                (ISO currency code)
+                                Default: $SURFRAW_bookfinder_currency
+                                Environment: SURFRAW_bookfinder_destination
+  -destination=                 Shipping destination
+                                (Two-digit ISO country code)
+                                Default: $SURFRAW_bookfinder_destination
+                                Environment: SURFRAW_bookfinder_destination
+  -first                        Search first editions
+  -keywords="..."               Search for keywords
+  -language=                    Search for books in...
+            de          |       German
+            en          |       English
+            es          |       Spanish
+            fr          |       French
+            it          |       Italian
+            nl          |       Dutch
+                                Default: $SURFRAW_bookfinder_language
+                                Environment: SURFRAW_bookfinder_language
+  -maxprice=                    Set the maximum acceptable price
+  -minprice=                    Set the minimum acceptable price
+  -search=                      Search by...
+          title
+          author
+          isbn
+                                Default: $SURFRAW_bookfinder_search
+                                Environment: SURFRAW_bookfinder_search
+  -signed                       Search for signed copies
+  -title="..."                  Search for a title.
+                                Complements -search=author
+  -type=                        Search books that are...
+        any             |       Any
+        new             |       New
+        used            |       Used and/or out of print
+                                Default: $SURFRAW_bookfinder_type
+                                Environment: SURFRAW_bookfinder_type
+EOF
+    w3_global_usage
+}
+
+w3_parse_option_hook () {
+    opt="$1"
+    optarg="$2"
+    case "$opt" in
+    -author=*)
+	setopt   SURFRAW_bookfinder_author      `w3_url_of_arg "$optarg"` ;;
+    -binding=any)   setopt   SURFRAW_bookfinder_binding     '*'           ;;
+    -binding=*)     setopt   SURFRAW_bookfinder_binding     "$optarg"     ;;
+    -classic)       setoptyn SURFRAW_bookfinder_classic     1             ;;
+    -currency=*)    setopt   SURFRAW_bookfinder_currency    "$optarg"     ;;
+    -destination=*) setopt   SURFRAW_bookfinder_destination "$optarg"     ;;
+    -first)         setoptyn SURFRAW_bookfinder_first       1             ;;
+    -keywords=*)
+	setopt   SURFRAW_bookfinder_keywords    `w3_url_of_arg "$optarg"` ;;
+    -language=*)    setopt   SURFRAW_bookfinder_language    "$optarg"     ;;
+    -maxprice=*)    setopt   SURFRAW_bookfinder_maxprice    "$optarg"     ;;
+    -minprice=*)    setopt   SURFRAW_bookfinder_minprice    "$optarg"     ;;
+    -search=*)      setopt   SURFRAW_bookfinder_search      "$optarg"     ;;
+    -signed)        setoptyn SURFRAW_bookfinder_signed      1             ;;
+    -title=*)
+	setopt   SURFRAW_bookfinder_title       `w3_url_of_arg "$optarg"` ;;
+    -type=any)      setopt   SURFRAW_bookfinder_type        '*'           ;;
+    -type=*)        setopt   SURFRAW_bookfinder_type        "$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
+    url="http://www.bookfinder.com/"
+else
+    escaped_args=`w3_url_of_arg $w3_args`
+    case "$SURFRAW_bookfinder_search" in
+        author) setopt SURFRAW_bookfinder_author "$escaped_args" ;;
+        isbn) setopt SURFRAW_bookfinder_isbn   "$escaped_args" ;;
+        title)  setopt SURFRAW_bookfinder_title  "$escaped_args" ;;
+        *) return 1 ;;
+    esac
+    url="http://www.bookfinder.com/search/?author=${SURFRAW_bookfinder_author}&title=${SURFRAW_bookfinder_title}&lang=${SURFRAW_bookfinder_language}&submit=Begin%20search&new_used=${SURFRAW_bookfinder_type}&destination=${SURFRAW_bookfinder_destination}&currency=${SURFRAW_bookfinder_currency}&binding=${SURFRAW_bookfinder_binding}&isbn=${SURFRAW_bookfinder_isbn}&keywords=${SURFRAW_bookfinder_keywords}&minprice=${SURFRAW_bookfinder_minprice}&maxprice=${SURFRAW_bookfinder_maxprice}&mode=advanced&st=sr&ac=qr"
+    if [ "$SURFRAW_bookfinder_classic" = 1 ]; then
+        url="${url}&classic=on"
+    fi
+    if [ "$SURFRAW_bookfinder_first" = 1 ]; then
+        url="${url}&first=on"
+    fi
+    if [ "$SURFRAW_bookfinder_signed" = 1 ]; then
+        url="${url}&signed=on"
+    fi
+fi
+w3_browse_url "$url"
+
+# End of file
diff --git a/links.IN b/links.IN
index 57dbd87..5bb71d0 100644
--- a/links.IN
+++ b/links.IN
@@ -10,6 +10,7 @@ elvi.1sr.gz @mandir@/man1/aur.1sr.gz
 elvi.1sr.gz @mandir@/man1/austlii.1sr.gz
 elvi.1sr.gz @mandir@/man1/bing.1sr.gz
 elvi.1sr.gz @mandir@/man1/bbcnews.1sr.gz
+elvi.1sr.gz @mandir@/man1/bookfinder.1sr.gz
 elvi.1sr.gz @mandir@/man1/bugmenot.1sr.gz
 elvi.1sr.gz @mandir@/man1/cddb.1sr.gz
 elvi.1sr.gz @mandir@/man1/cite.1sr.gz
diff --git a/test/Makefile.am b/test/Makefile.am
index c4c7d2d..5121cf7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,9 +1,9 @@
 EXTRA_DIST = runtests elviwithouttests README COOKIES W.test		\
 	acronym.test alioth.test altavista.test amazon.test		\
 	archpkg.test arxiv.test ask.test aur.test austlii.test		\
-	bbcnews.test bugmenot.test cddb.test cia.test cite.test	 	\
-	cliki.test cnn.test codesearch.test comlaw.test ctan.test 	\
-	currency.test cve.test debbugs.test debcontents.test	 	\
+	bbcnews.test bookfinder bugmenot.test cddb.test cia.test	\
+	cite.test cliki.test cnn.test codesearch.test comlaw.test	\
+	ctan.test currency.test cve.test debbugs.test debcontents.test	\
 	deblists.test deblogs.test debpackages.test debpkghome.test 	\
 	debpts.test debsec.test debvcsbrowse.test debwiki.test	 	\
 	deja.test discogs.test dmoz.test ebay.test etym.test	 	\
diff --git a/test/Makefile.in b/test/Makefile.in
index a6240ae..8b451fc 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -122,9 +122,9 @@ top_srcdir = @top_srcdir@
 EXTRA_DIST = runtests elviwithouttests README COOKIES W.test		\
 	acronym.test alioth.test altavista.test amazon.test		\
 	archpkg.test arxiv.test ask.test aur.test austlii.test		\
-	bbcnews.test bugmenot.test cddb.test cia.test cite.test	 	\
-	cliki.test cnn.test codesearch.test comlaw.test ctan.test 	\
-	currency.test cve.test debbugs.test debcontents.test	 	\
+	bbcnews.test bookfinder bugmenot.test cddb.test cia.test	\
+	cite.test cliki.test cnn.test codesearch.test comlaw.test	\
+	ctan.test currency.test cve.test debbugs.test debcontents.test	\
 	deblists.test deblogs.test debpackages.test debpkghome.test 	\
 	debpts.test debsec.test debvcsbrowse.test debwiki.test	 	\
 	deja.test discogs.test dmoz.test ebay.test etym.test	 	\
diff --git a/test/bookfinder.test b/test/bookfinder.test
new file mode 100644
index 0000000..f4e00de
--- /dev/null
+++ b/test/bookfinder.test
@@ -0,0 +1,6 @@
+bookfinder 1984
+Nineteen Eighty-Four
+bookfinder -search=isbn 1556229119
+3D Math Primer for Graphics and Game Development
+bookfinder -search=author Carl Sagan
+Pale Blue Dot

-- 
surfraw -  a fast unix command line interface to WWW



More information about the Surfraw-commits mailing list