[open-ils-commits] r9761 - trunk/Open-ILS/src/extras
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jun 3 20:53:53 EDT 2008
Author: miker
Date: 2008-06-03 20:53:52 -0400 (Tue, 03 Jun 2008)
New Revision: 9761
Added:
trunk/Open-ILS/src/extras/openurl_map.pl
Log:
mod_rewrite mapping script for openurl->opensearch
Added: trunk/Open-ILS/src/extras/openurl_map.pl
===================================================================
--- trunk/Open-ILS/src/extras/openurl_map.pl (rev 0)
+++ trunk/Open-ILS/src/extras/openurl_map.pl 2008-06-04 00:53:52 UTC (rev 9761)
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+#
+
+$|=1;
+
+while (my $openurl = <>) {
+ my $opensearch = '/opac/extras/opensearch/1.1/-/marcxml/-/?';
+ my @parts = split('&', $openurl);
+
+ my %params = (
+ kw => '',
+ au => '',
+ ti => '',
+ );
+
+ for (@parts) {
+ if (/^au[^=]+=(.*)$/o) {
+ $params{au} .= $1 . ' ';
+ } elsif (/^[sa]?title=(.*)$/o) {
+ $params{ti} .= $1 . ' ';
+ } elsif (/^e?is.n=(.*)$/o) {
+ $params{kw} .= $1 . ' ';
+ } elsif (/^[^=]+=(.*)$/o) {
+ $params{kw} .= $1 . ' ';
+ }
+ }
+
+ $opensearch .= join('&', map { "$_=$params{$_}" } keys %params );
+
+ print $opensearch . "\n";
+
+};
Property changes on: trunk/Open-ILS/src/extras/openurl_map.pl
___________________________________________________________________
Name: svn:executable
+ *
More information about the open-ils-commits
mailing list