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

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

Manual correction to a few MIR generated values

  • Property svn:executable set to *
File size: 2.2 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')"
50
51
52#for d in $tmp_cache/sparqlresults-* ; do
53# tail_d=${d##*/}
54# cat $tmp_cache/$tail_d/metadata.xml \
55# | sed 's/mode="accumulate"/mode="override"/' > ../import/$tail_d/metadata-esc-mir-gold.xml
56#done
57
58
59num_explode_subdirs=`ls -d $tmp_cache/sparqlresults-local--esc-mir-gold* | wc -l`
60
61if [ "x$num_explode_subdirs" != "x1" ] ; then
62 echo "Error: This script is designed for all the results results from exploding to be" 1>&2
63 echo " in a single subdirectory" 1>&2
64 echo " In $tmp_cache found: $num_explode_subdirs" 1>&2
65 exit 1
66fi
67
68for d in ../import/sparqlresults-* ; do
69 cat $tmp_cache/sparqlresults-local--esc-mir-gold/metadata.xml \
70 | sed 's/mode="accumulate"/mode="override"/' > $d/metadata_esc_mir_gold.xml
71 # add to this a few manually overridden metadata values
72 /bin/cp metadata_esc_mir_gold__override.xml $d/.
73done
74
75/bin/rm -rf $tmp_cache/sparqlresults-*
76
77
78echo ""
Note: See TracBrowser for help on using the repository browser.