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

Ian Beckwith ianb at erislabs.net
Wed Dec 8 06:18:16 UTC 2010


The following commit has been merged in the master branch:
commit 34aa81346806b57611a3536416c24975d1cce988
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Wed Dec 8 06:17:13 2010 +0000

    New elvi: pasearch - by jakob at pipefour.org

diff --git a/AUTHORS b/AUTHORS
index eeaced9..7562e21 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -110,6 +110,9 @@ Jameson Rollins <jrollins at finestructure.net>
         elvi: ads
         plus tweaks.
 
+Jakob <jakob at pipefour.org>
+        elvi: pasearch
+
 THANKS TO
 
 Brian Nelson           <bnelson at bloodclot.net>
diff --git a/ChangeLog b/ChangeLog
index 6cb544f..2cd11c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-04  Jakob <jakob at pipefour.org>
+
+	* new elvis: pasearch.
+
 2010-12-08  Ian Beckwith  <ianb at erislabs.net>
 
 	* arxiv: Thanks to MT <mt_void at warpmail.net> for patch that fixes:
diff --git a/README b/README
index 28a1600..dec61a6 100644
--- a/README
+++ b/README
@@ -224,6 +224,7 @@ ntrs              -- Search the NASA Technical Report Server
 openbsd           -- Search OpenBSD related information (www.openbsd.org)
 opensearch        -- Search an OpenSearch-enabled website
 pgpkeys           -- Search the PGP key database
+pasearch          -- Search the unofficial Penny Arcade archives (pipefour.org/pa)
 piratebay         -- Search thepiratebay.org for torrents
 port              -- Look up a TCP/UDP port number on seifried.org/security/ports/
 pubmed            -- Search medical/molbio databases (www.ncbi.nlm.nih.gov)
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index 7be399f..6da5d9b 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -70,6 +70,7 @@ dist_elvi_SCRIPTS	= \
 		  netbsd \
 		  ntrs \
 		  openbsd \
+		  pasearch \
 		  piratebay \
 		  pgpkeys \
 		  port \
diff --git a/elvi/pasearch b/elvi/pasearch
new file mode 100755
index 0000000..6417c56
--- /dev/null
+++ b/elvi/pasearch
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# AUTHOR: jakob
+#
+# DATE: 2010.12.04
+#
+# DESC: Elvis to search the unofficial Penny Arcade archives
+# elvis: pasearch	-- Search the unofficial Penny Arcade archives (pipefour.org/pa)
+. surfraw || exit 1
+
+w3_usage_hook () {
+	cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+  Search the unofficial Penny Arcade archives (pipefour.org/pa)
+Local options:
+  -t/-T				Enable/disable searching title field
+				Default: yes
+				Environment: SURFRAW_pasearch_search_title
+  -b/-B				Enable/disable searching body field
+				Default: yes
+				Environment: SURFRAW_pasearch_search_body
+  -n/-N				Enable/disable searching notes field
+				Default: yes
+				Environment: SURFRAW_pasearch_search_notes
+  -p/-P				Enable/disable showing preview thumbnails
+				Default: yes
+				Environment: SURFRAW_pasearch_show_previews
+EOF
+	w3_global_usage
+}
+
+w3_config_hook () {
+	defyn SURFRAW_pasearch_search_title  1
+	defyn SURFRAW_pasearch_search_body   1
+	defyn SURFRAW_pasearch_search_notes  1
+	defyn SURFRAW_pasearch_show_previews 1
+}
+
+w3_parse_option_hook () {
+	opt="$1"
+	optarg="$2"
+	case "$opt" in
+		-t) setoptyn SURFRAW_pasearch_search_title  1 ;;
+		-T) setoptyn SURFRAW_pasearch_search_title  0 ;;
+		-b) setoptyn SURFRAW_pasearch_search_body   1 ;;
+		-B) setoptyn SURFRAW_pasearch_search_body   0 ;;
+		-n) setoptyn SURFRAW_pasearch_search_notes  1 ;;
+		-N) setoptyn SURFRAW_pasearch_search_notes  0 ;;
+		-p) setoptyn SURFRAW_pasearch_show_previews 1 ;;
+		-P) setoptyn SURFRAW_pasearch_show_previews 0 ;;
+		*) return 1 ;;
+	esac
+	return 0
+}
+
+w3_config
+w3_parse_args "$@"
+
+# Make sure they have at least one field enabled
+ifno SURFRAW_pasearch_search_title &&
+ifno SURFRAW_pasearch_search_body &&
+ifno SURFRAW_pasearch_search_notes &&
+	err You can\'t search 0 fields.
+
+if test -z "$w3_args"; then
+	w3_browse_url "http://pipefour.org/pa/"
+else
+	escaped_args=`w3_url_of_arg $w3_args`
+	ifyes SURFRAW_pasearch_search_title && fields=${fields}'&search[]=title'
+	ifyes SURFRAW_pasearch_search_body && fields=${fields}'&search[]=body'
+	ifyes SURFRAW_pasearch_search_notes && fields=${fields}'&search[]=notes'
+
+	thumbs="off"
+	ifyes SURFRAW_pasearch_show_previews && thumbs=on
+
+	w3_browse_url "http://pipefour.org/pa/search.php?thumbs=${thumbs}&${fields}&q=${escaped_args}"
+fi
diff --git a/links.IN b/links.IN
index 9b54a7f..8bcf0a6 100644
--- a/links.IN
+++ b/links.IN
@@ -66,6 +66,7 @@ elvi.1sr.gz @mandir@/man1/musicbrainz.1sr.gz
 elvi.1sr.gz @mandir@/man1/netbsd.1sr.gz
 elvi.1sr.gz @mandir@/man1/ntrs.1sr.gz
 elvi.1sr.gz @mandir@/man1/openbsd.1sr.gz
+elvi.1sr.gz @mandir@/man1/pasearch.1sr.gz
 elvi.1sr.gz @mandir@/man1/piratebay.1sr.gz
 elvi.1sr.gz @mandir@/man1/pgpkeys.1sr.gz
 elvi.1sr.gz @mandir@/man1/port.1sr.gz
diff --git a/test/Makefile.am b/test/Makefile.am
index d897fe2..fbf0e27 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -14,8 +14,8 @@ EXTRA_DIST = runtests elviwithouttests README COOKIES W.test		\
 	ixquick.test jamendo.test javasun.test lastfm.test		\
 	leodict.test l1sp.test lsm.test macports.test mathworld.test	\
 	mininova.test musicbrainz.test netbsd.test ntrs.test		\
-	openbsd.test opensearch.test piratebay.test port.test		\
-	pgpkeys.test pubmed.test rae.test rfc.test rhyme.test		\
+	openbsd.test opensearch.test pasearch.test piratebay.test	\
+	port.test pgpkeys.test pubmed.test rae.test rfc.test rhyme.test	\
 	rpmsearch.test scholar.test scicom.test scitopia.test		\
 	scirus.test scpan.test scroogle.test slashdot.test		\
 	slinuxdoc.test sourceforge.test springer.test stockquote.test	\
diff --git a/test/pasearch.test b/test/pasearch.test
new file mode 100644
index 0000000..8867c27
--- /dev/null
+++ b/test/pasearch.test
@@ -0,0 +1,8 @@
+pasearch
+Pipe Four
+pasearch gabe
+Pipe Four
+pasearch wax pig
+Virtually Unlimited Potential
+pasearch -p gabe
+\<th\> Preview \<\/th\>

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



More information about the Surfraw-commits mailing list