1 | #!/bin/bash
|
---|
2 |
|
---|
3 | prep_dir=spotify-musicbrainz
|
---|
4 |
|
---|
5 | if [ ! -d ./my-python3 ] ; then
|
---|
6 | echo "" 1>&2
|
---|
7 | echo "Failed to find: ./my-python3" 1>&2
|
---|
8 | echo "Have you run:" 1>&2
|
---|
9 | echo " ./CREATE-PYTHON-VENV.sh" 1>&2
|
---|
10 | echo "" 1>&2
|
---|
11 |
|
---|
12 | exit 1
|
---|
13 | fi
|
---|
14 |
|
---|
15 | source ./my-python3/bin/activate
|
---|
16 |
|
---|
17 | if [ ! -d "$prep_dir" ] ; then
|
---|
18 | echo "Checking out Spotify/MusicBrainz Alignment code:"
|
---|
19 | git clone https://github.com/musicog/LinkedEurovision.git "$prep_dir"
|
---|
20 | cd "$prep_dir" && pip3 install -r requirements.txt && cd ..
|
---|
21 |
|
---|
22 | if [ $? != 0 ] ; then
|
---|
23 | echo "!!!!" 1>&2
|
---|
24 | echo "! Error enountered running gs-triplestore-reset3 followed by gs-triplestore-add3" 1>&2
|
---|
25 | echo "!!!!" 1>&2
|
---|
26 |
|
---|
27 | deactivate
|
---|
28 | exit 1
|
---|
29 | fi
|
---|
30 | fi
|
---|
31 |
|
---|
32 | if [ ! -f "$prep_dir/cached--esc-mir-gold-rdf.ttl" ] ; then
|
---|
33 | echo "Generating $prep_dir/cached--esc-mir-gold-rdf.ttl"
|
---|
34 |
|
---|
35 | echo "Running Spotify/MusicBrainz Alignment" > 07-DOWNLOAD-runtime-log-$$.txt
|
---|
36 | echo "Started: " >> 07-DOWNLOAD-runtime-log-$$.txt
|
---|
37 | date >> 07-DOWNLOAD-runtime-log-$$.txt
|
---|
38 |
|
---|
39 | cd "$prep_dir" && ./RUN.sh && cd ..
|
---|
40 |
|
---|
41 | if [ $? != 0 ] ; then
|
---|
42 | echo "!!!!" 1>&2
|
---|
43 | echo "! Error enountered running $pref_dir/RUN.sh" 1>&2
|
---|
44 | echo "!!!!" 1>&2
|
---|
45 |
|
---|
46 | deactivate
|
---|
47 | exit 1
|
---|
48 | fi
|
---|
49 |
|
---|
50 | echo "Finished: " > 07-DOWNLOAD-runtime-log-$$.txt
|
---|
51 | date >> 07-DOWNLOAD-runtime-log-$$.txt
|
---|
52 |
|
---|
53 | fi
|
---|
54 |
|
---|
55 | # Reset graph and then Ingest the newly generated .ttl file
|
---|
56 | echo "Reseting and then populating the triplestore graph-collection"
|
---|
57 | echo " eurovision-mir"
|
---|
58 | gs-triplestore-reset3 eurovision-mir && gs-triplestore-add3 eurovision-mir "$prep_dir/esc-mir-gold-rdf.ttl"
|
---|
59 |
|
---|
60 | if [ $? != 0 ] ; then
|
---|
61 | echo "!!!!" 1>&2
|
---|
62 | echo "! Error enountered running gs-triplestore-reset3 followed by gs-triplestore-add3" 1>&2
|
---|
63 | echo "!!!!" 1>&2
|
---|
64 |
|
---|
65 | deactivate
|
---|
66 | exit 1
|
---|
67 | fi
|
---|
68 |
|
---|
69 | echo "Generating:"
|
---|
70 | echo " $prep_dir/local--esc-mir-gold.json"
|
---|
71 | gs-triplestore-file-query3 "$prep_dir/local--esc-mir-gold.sparql"
|
---|
72 |
|
---|
73 |
|
---|
74 | deactivate
|
---|
75 |
|
---|