source: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/08-EXPLODE-SPOTIFY-SPARQLRESULTS-TO-IMPORT.sh@ 35111

Last change on this file since 35111 was 35111, checked in by davidb, 3 years ago

Added extra echo statement to detail what is going on

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/bin/bash
2
3tmp_cache="tmp-cache"
4
5cwd=`pwd`
6cwd_without_prepare=${cwd%/*}
7collection=${cwd_without_prepare##*/}
8
9echo ""
10
11if [ "x$GSDL3SRCHOME" = "x" ] ; then
12 echo "Environment variable GSDL3SRCHOME not set." 1>&2
13 echo "Have you sourced ./gs3-setup.sh?" 1>&2
14 exit 1
15fi
16
17if [ ! -d $tmp_cache ] ; then
18 echo "Making temporary directory:"
19 echo " $tmp_cache"
20 mkdir $tmp_cache
21else
22 echo "Removing existing content from:"
23 echo " $tmp_cache"
24 /bin/rm -rf $tmp_cache/*
25fi
26
27echo "Copying to '$tmp_cache' then exploding:"
28
29f="local--esc-mir-gold.json"
30echo " spotify-musicbrainz/$f -> $tmp_cache/sparqlresults-$f"
31/bin/cp "spotify-musicbrainz/$f" "$tmp_cache/sparqlresults-$f"
32
33explode_metadata_database.pl \
34 -records_per_folder 2000 \
35 -collectdir $GSDL3SRCHOME/web/sites/eurovision-lod/collect \
36 -collection $collection \
37 -plugin_options "-metadata_merge_on_concat_fields Country,Year -OIDtype assigned -OIDmetadata Identifier" \
38 -plugin JSONSPARQLResultPlugin \
39 $tmp_cache/sparqlresults-$f
40
41if [ $? != 0 ] ; then
42 echo "Error encountered when exploding:" 1>&2
43 echo " $tmp_cache/sparqlresults-$f" 1>&2
44 exit 1
45fi
46
47
48echo ""
49echo "Adding metadata_esc_mir_gold.xml to the sparqlresults-* directories in '../import' (from exploded results in '$tmp_cache')"
50echo " Along with a manually assigned override file metadata_esc_mir_gold__override.xml"
51
52num_explode_subdirs=`ls -d $tmp_cache/sparqlresults-local--esc-mir-gold* | wc -l`
53
54if [ "x$num_explode_subdirs" != "x1" ] ; then
55 echo "Error: This script is designed for all the results results from exploding to be" 1>&2
56 echo " in a single subdirectory" 1>&2
57 echo " In $tmp_cache found: $num_explode_subdirs" 1>&2
58 exit 1
59fi
60
61for d in ../import/sparqlresults-* ; do
62 cat $tmp_cache/sparqlresults-local--esc-mir-gold/metadata.xml \
63 | sed 's/mode="accumulate"/mode="override"/' > $d/metadata_esc_mir_gold.xml
64 # add to this a few manually overridden metadata values
65 /bin/cp metadata_esc_mir_gold__override.xml $d/.
66done
67
68/bin/rm -rf $tmp_cache/sparqlresults-*
69
70
71echo ""
Note: See TracBrowser for help on using the repository browser.