source: gs3-installations/intermuse/trunk/sites/intermuse/collect/programmes-and-performers/INDEX-IIIF-MANIFEST.sh@ 37157

Last change on this file since 37157 was 37157, checked in by davidb, 15 months ago

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

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2
3source ../_local_collect_config.sh
4
5
6# Build up URL through static 'site' URL to collect/<openannotation>.json
7#iuri_prefix=http://localhost:4343/greenstone3/library/sites/intermuse/collect/$col
8
9## ifilename=${1:-archives/HASH012c.dir/openannotation-list.json}
10#ifilename=${1:-amadeus-iiif-manifest--with-otherContent.json}
11
12
13##iuri_tail=${ifilename#archives/}
14
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"
46
47internal_url_base="http://localhost:4343/simpleAnnotationStore"
48
49post_url="${internal_url_base}/manifests"
50
51echo ""
52
53echo curl -X POST -d \"uri=${iuri}\" \"$post_url\"
54curl -X POST -d "uri=${iuri}" "$post_url"
55
56#if [ $? = 0 ] ; then
57# /bin/rm tmp/doc-openannotation--with-otherContent.json
58#fi
59
60echo ""
61
62
63# Returns JSON output of the form:
64# {"loaded":{"short_id":"f3bac06f17c9240b76b082dbdcbb365a","uri":"http-greenstone://intermuse/programmes/HASH012cd965c3e83d504f4a78cd/manifest"}}
65
66# 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 TracBrowser for help on using the repository browser.