Ignore:
Timestamp:
2023-01-18T23:48:08+13:00 (15 months ago)
Author:
davidb
Message:

Script now at proof-of-concept to show that within-doc search can work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes-and-performers/INDEX-IIIF-MANIFEST.sh

    r37124 r37157  
    1 #!/bin/bash -x
     1#!/bin/bash
    22
    33source ../_local_collect_config.sh
    44
    55
    6 iuri_prefix=http://localhost:4343/greenstone3/library/sites/intermuse/collect/$col
     6# Build up URL through static 'site' URL to collect/<openannotation>.json
     7#iuri_prefix=http://localhost:4343/greenstone3/library/sites/intermuse/collect/$col
    78
    8 # ifilename=${1:-archives/HASH012c.dir/openannotation-list.json}
    9 ifilename=${1:-amadeus-iiif-manifest.json}
     9## ifilename=${1:-archives/HASH012c.dir/openannotation-list.json}
     10#ifilename=${1:-amadeus-iiif-manifest--with-otherContent.json}
    1011
    11 #iuri_tail=${ifilename#archives/}
    1212
    13 #iuri="${iuri_prefix}${iuri_tail}"
    14 iuri="${iuri_prefix}/${ifilename}"
     13##iuri_tail=${ifilename#archives/}
    1514
     15##iuri="${iuri_prefix}${iuri_tail}"
     16#iuri="${iuri_prefix}/${ifilename}"
     17
     18
     19docid="${1:-HASH012cd965c3e83d504f4a78cd}"
     20
     21download_url="$gs_library_url/collection/$col/document/$docid"
     22download_url="$download_url?sa=iiif-manifest&ed=1&includeFileAssocOpenAnnotations=true&excerptid-text=iiif-manifest"
     23
     24if [ ! -d tmp ] ; then
     25echo ""
     26    echo "Making directory 'tmp'"
     27    mkdir tmp
     28fi
     29
     30# Workaround for JSON parsing error.  When using the Greenstone document URL directly
     31# then POSTing to /simpleAnnotationStore/manifests resulted in a JSON error
     32# Issue caused by leading blank space
     33#
     34# Workaround is to download it as collect/tmp/doc-openannotation--with-otherContent.json
     35# and as part of that process, strip out whitespace.
     36# Then a new URL is built to the collect/tmp/doc-openannotation--with-otherContent.json
     37# and that version of the file is POSTed to /simpleAnnotationStore/manifests
     38
     39echo ""
     40echo "Downloading openannotation JSON for $docid as workaround to strip out leading blank space"
     41echo ""
     42curl "$download_url" | egrep -v "^\\s*$" > tmp/doc-openannotation--with-otherContent.json
     43
     44
     45iuri="$gs_library_url/sites/intermuse/collect/$col/tmp/doc-openannotation--with-otherContent.json"
    1646
    1747internal_url_base="http://localhost:4343/simpleAnnotationStore"
     
    2151echo ""
    2252
    23 echo curl -X POST -d "uri=${iuri}" "$post_url"
     53echo curl -X POST -d \"uri=${iuri}\" \"$post_url\"
    2454curl -X POST -d "uri=${iuri}" "$post_url"
     55
     56#if [ $? = 0 ] ; then
     57#    /bin/rm tmp/doc-openannotation--with-otherContent.json
     58#fi
    2559
    2660echo ""
     
    3165
    3266# The short_id is needed to ...
     67
     68
     69# {"loaded":{"short_id":"e2465cd7e5174f2720cee110d9b4a06a","uri":"http-greenstone://intermuse/programmes-and-performers/HASH012cd965c3e83d504f4a78cd/manifest"}}+ echo ''
Note: See TracChangeset for help on using the changeset viewer.