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

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

Further development of manifest indexing for search

  • Property svn:executable set to *
File size: 2.3 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 " $download_url"
42echo ""
43curl "$download_url" | egrep -v "^\\s*$" > tmp/doc-openannotation--with-otherContent.json
44
45
46iuri="$gs_library_url/sites/intermuse/collect/$col/tmp/doc-openannotation--with-otherContent.json"
47
48internal_url_base="http://localhost:4343/simpleAnnotationStore"
49
50post_url="${internal_url_base}/manifests"
51
52echo ""
53
54echo curl -X POST -d \"uri=${iuri}\" \"$post_url\"
55curl -X POST -d "uri=${iuri}" "$post_url"
56
57#if [ $? = 0 ] ; then
58# /bin/rm tmp/doc-openannotation--with-otherContent.json
59#fi
60
61echo ""
62
63
64# Returns JSON output of the form:
65# {"loaded":{"short_id":"f3bac06f17c9240b76b082dbdcbb365a","uri":"http://ld.greenstone.org/intermuse/programmes/HASH012cd965c3e83d504f4a78cd/manifest"}}
66
67# The short_id is needed to ...
68
69
70# {"loaded":{"short_id":"e2465cd7e5174f2720cee110d9b4a06a","uri":"http://ld.greenstone.org/intermuse/programmes-and-performers/HASH012cd965c3e83d504f4a78cd/manifest"}}+ echo ''
Note: See TracBrowser for help on using the repository browser.