Skip to content

Instantly share code, notes, and snippets.

@dannylamb
Created April 30, 2020 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannylamb/2f51722514a699a71fc60f041a838764 to your computer and use it in GitHub Desktop.
Save dannylamb/2f51722514a699a71fc60f041a838764 to your computer and use it in GitHub Desktop.
#/bin/bash
set -euxo pipefail
COLLECTION_NID=`curl -sSf -X POST -u changeme:changeme -H "Content-Type: application/json" -d "{\"title\": [\"Christian Martyrdom\"], \"type\": \"islandora_object\", \"field_model\": [30]}" http://future.islandora.ca/entity/node?_format=json | jq -re '.nid[0].value'`
for file in *.jpg; do
PAGE_NID=`curl -sSf -X POST -u changeme:changeme -H "Content-Type: application/json" -d "{\"title\": [\"$file\"], \"type\": \"islandora_object\", \"field_member_of\": [$COLLECTION_NID], \"field_model\": [31]}" http://future.islandora.ca/entity/node?_format=json | jq -re '.nid[0].value'`
curl -sSf -X PUT -u changeme:changeme -H "Content-Type: image/jpeg" -H "Content-Location: fedora://2020-04/$file" --data-binary @"$file" "http://future.islandora.ca/node/$PAGE_NID/media/image/16"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment