X-Git-Url: http://git.sitka.bclibraries.ca/gitweb/?p=sitka%2Fsitka-tools.git;a=blobdiff_plain;f=marc_export_custom%2Fsitka-full-export-bslw.sh;h=e0cb09366e4157b0bf2fa39aba8fdc1d43b814c7;hp=c317a8f78c387195e2b765627cea22ee0245b84d;hb=157b7812441397f0e6123a824f88706041d1d2f7;hpb=77800fb584b6e5111f746c1f559095bfe89bfd86 diff --git a/marc_export_custom/sitka-full-export-bslw.sh b/marc_export_custom/sitka-full-export-bslw.sh index c317a8f..e0cb093 100755 --- a/marc_export_custom/sitka-full-export-bslw.sh +++ b/marc_export_custom/sitka-full-export-bslw.sh @@ -1,15 +1,14 @@ #!/bin/bash -DIR=`dirname $0` +DIR=$(readlink -f $(dirname $0)) #cd /srv/openils/bin PGUSER=evergreen -PGHOST=db1.sitka.bclibraries.ca +PGHOST=prod-pg94-db2-sitka.sitka.bclibraries.ca PSQL="psql -A -t -U $PGUSER -h $PGHOST" DATABASE=evergreen FULL_QUERY="select id from biblio.record_entry where not deleted" -TNRD_QUERY="select distinct record FROM asset.call_number where owning_lib in (select distinct id from actor.org_unit_descendants(50)) and not deleted;" -MARC_PARAMS="--config /srv/openils/conf/opensrf_core.xml --timeout 300 --force901 --encoding UTF-8" +MARC_PARAMS="--config /srv/openils/conf/opensrf_core.xml --timeout 300 --force901 --encoding UTF-8 --quiet" MARC_EXPORT_BIN="${DIR}/marc_export_custom" MARC_EXPORT="${MARC_EXPORT_BIN} ${MARC_PARAMS}" @@ -47,13 +46,30 @@ split_suffix() { find $(dirname ${output_prefix}) -name "$(basename ${output_prefix})*" -exec mv -f \{\} \{\}${output_suffix} \; } -# TNRD dump -export SPLIT_COUNT=10000 -F=tnrd SQL="$TNRD_QUERY" -process_batch "$F" "${SQL}" $SPLIT_COUNT - export SPLIT_COUNT=100000 # full dump for all libraries F=sitka_full_backstage SQL="$FULL_QUERY" process_batch "$F" "${SQL}" $SPLIT_COUNT + + +#Separate file of 901s for BKCT +TNRD_ALLRECS="SELECT DISTINCT acn.record FROM asset.call_number acn JOIN biblio.record_entry bre ON (acn.record = bre.id) WHERE NOT bre.deleted AND bre.active AND not acn.deleted AND owning_lib IN (SELECT id FROM actor.org_unit_descendants(50)) and acn.label != '##URI##'" +$PSQL -t -A -c "$TNRD_ALLRECS" $DATABASE |sort|uniq > ${OUTDIR}/tnrd-all-recs.id + +# Separate file of 901s for MB Leg Library +MBLEG_ALLRECS="SELECT DISTINCT acn.record FROM asset.call_number acn JOIN biblio.record_entry bre ON (acn.record = bre.id) WHERE NOT bre.deleted AND bre.active AND not acn.deleted AND owning_lib IN (SELECT id FROM actor.org_unit_descendants(1100))" +$PSQL -t -A -c "$MBLEG_ALLRECS" $DATABASE |sort|uniq > ${OUTDIR}/mbleg-all-recs.id + +# Separate file of 901s for av recs +AV_RECS="SELECT DISTINCT acn.record FROM asset.call_number acn JOIN asset.copy acp ON (acn.id = acp.call_number) JOIN biblio.record_entry bre ON (acn.record = bre.id) WHERE NOT bre.deleted AND bre.active AND not acn.deleted AND acp.circ_modifier IN ('3-week-videos','audio-cassette','audio-cds','audio-cds-cnib','audiobook-impaired','book-and-disk','cassette-and-book','cassette-and-book-in-bag','cassettebook','cassettebooks','cassettes','cd-and-book','cd-and-book-in-bag','cd-audiobook','cd-rom','cd-roms','compact-disc','compact-discs','digital-disc','dvd','dvd-feature','dvd-rom','dvd-short','dvdsd','film','juvenile-audio-cassette','juvenile-audio-visual','juvenile-video','kit','mp-3-audio-disc','nfb-videos','restricted-dvd','restricted-video','talking-books','talking-tape-cnib','video','video-cassette','video-collection','videos','videos-educational','videos-features','videosd')" +$PSQL -t -A -c "$AV_RECS" $DATABASE |sort|uniq > ${OUTDIR}/audiovisual-recs.id + + +# TNRD Outreach Records +TNRD_OUTREACHRECS="select record FROM asset.call_number acn join asset.copy acp on (acp.call_number = acn.id) where label ~ '^AB' and owning_lib in (64,65) and acp.circ_modifier = 'audiobook-impaired';" +$PSQL -t -A -c "$TNRD_OUTREACHRECS" $DATABASE |sort|uniq > ${OUTDIR}/tnrd-outreach-recs.id + +# Electornic Records +ELECTONIC_RECS="select distinct record from asset.call_number where label = '##URI##' and not deleted and id not in (select call_number from asset.copy where not deleted);" +$PSQL -t -A -c "$ELECTRONIC_RECS" $DATABASE |sort|uniq > ${OUTDIR}/electronic-recs.id