III Importer Question

0 views
Skip to first unread message

Brett

unread,
Jun 17, 2008, 6:00:02 PM6/17/08
to Scriblio
I'm trying to import just records for my library from a shared
Millennium instance. I'm at Collingswood, so I want this record

http://iii.camden.lib.nj.us/search?/aeugenides/aeugenides/1%2C1%2C3%2CB/frameset&FF=aeugenides+jeffrey&2%2C%2C3/indexsort=-

but not this record

http://iii.camden.lib.nj.us/search/?searchtype=a&searcharg=eugenides&searchscope=5&sortdropdown=-&SORT=D&extended=0&SUBMIT=Search&searchlimits=&searchorigarg=aeugenides

or any others from the pulldown menu. I just want Collingswood.

I'm trying to indicate that within a function. I copied iii_get_record
and named it iii_get_collingswood_record (see below), but the III
importer seems to getting all records within the bib range. Please let
me know what I should have done instead.

function iii_get_collingswood_record($host, $bibn){
if(strpos(file_get_contents('http://'. $host .'/record=b'. $bibn),
'No matches found')){
$this->warn = 'Record number '. $bibn .' is suppressed or
deleted.';
return(FALSE);
}

$recordurl = 'http://'. $host .'/search/.b'. $bibn .'/.b'. $bibn .'/
1%2C1%2C1%2CB/marc~b'. $bibn;

if(function_exists('mb_convert_encoding'))
$record = mb_convert_encoding(file_get_contents($recordurl),
'UTF-8');
else
$record = file_get_contents($recordurl);

if(!empty($record)){
preg_match('/^<!-- field 1 -->&nbsp; Collingswood/', $record,
$stuff);
return($stuff[1]);
}
$this->error = 'Host unreachable or no parsable data found for
record number '. $bibn .'.';
return(FALSE);
}

Casey Bisson

unread,
Jun 20, 2008, 9:47:04 AM6/20/08
to scri...@googlegroups.com
Brett,

In the short term, you should be able to simply modify the existing
iii_get_record function like this:

function iii_get_record($host, $bibn){
$prefs = get_option('scrib_iiiimporter');

if( !strpos( file_get_contents( 'http://'. $host .'/record=b'.
$bibn), '&nbsp; Collingswood ' )){


$this->warn = 'Record number '. $bibn .' is suppressed or deleted.';
return(FALSE);
}


Note the "!strpos" and the changed text from 'No matches found' to
'&nbsp; Collingswood '. I've not tested it, but that (or something
like it) should get you on your way.

--Casey

Reply all
Reply to author
Forward
0 new messages