123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #copy content of directory to orthanc
- #works for orthanc 1.12.0, not for 1.6.1
- if [ $# -lt 1 ] ; then
- echo $#;
- echo Usage $0 DIR networkConfig;
- exit 0;
- fi;
- CFG=$2;
- USER=$(jq -r ".orthanc.user" $CFG);
- PASSWORD=$(jq -r ".orthanc.password" $CFG);
- SERVER=$(jq -r ".orthanc.server" $CFG);
- CURL="curl -u $USER:$PASSWORD"
- arr=($(echo $1/*.zip));
- Nall=${#arr[@]};
- N=$Nall
- echo Loading $N/$Nall;
- i=0
- for ((j=0;j<Nall;j++)) ; do
- #ls ${arr[j]};
- R=$($CURL -X POST $SERVER/instances --data-binary "@${arr[j]}" |jq -r ".[] | .Status");
-
- for x in $R ; do
- #echo $x;
- if [ $x == "AlreadyStored" ] ; then
- #echo Done
- break;
- else
- #echo New
- i=$((i+1));
- break;
- fi;
- done;
- if [ $i -eq $N ] ; then
- #echo "[$i/$N] Done"
- break;
- else
- #echo "[$i/$N] Not done"
- :
- fi;
- echo "Done [$j/$Nall, new $i]"
- done;
|