Skip to content

Commit

Permalink
Merge pull request #765 from dchiller/i-761-change-links-to-NewCantus
Browse files Browse the repository at this point in the history
Update links to CantusDB (cantus.waterloo.ca --> cantusdatabase.org)
  • Loading branch information
dchiller authored Sep 19, 2023
2 parents 9b176e9 + 3b4d234 commit d836bf0
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 30 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [Cantus Ultimus](http://cantus.simssa.ca/)

Serving images on a website using [Apache Solr](http://lucene.apache.org/solr/), [Diva.js](https://ddmal.github.io/diva.js/) and the [CANTUS](http://cantusdatabase.org/) collection.
Serving images on a website using [Apache Solr](http://lucene.apache.org/solr/), [Diva.js](https://ddmal.github.io/diva.js/) and the [CANTUS](https://cantusdatabase.org/) collection.

The status of manuscripts served by Cantus Ultimus is available [here](#manuscript-inventory). Inclusion of additional manuscripts should be recorded there.

Expand Down Expand Up @@ -106,7 +106,7 @@ Using your admin credentials, verify that you are able to log into the admin dja

When navigating through any of the tables in the admin interface (e.g., Manuscripts, Concordances, and Chants), they will appear to be empty.

We can pre-populate the Concordances, Manuscripts, and Chants from the information available in the [Cantus Database](http://cantus.uwaterloo.ca/).
We can pre-populate the Concordances, Manuscripts, and Chants from the information available in the [Cantus Database](https://cantusdatabase.org/).

The scripts to populate the database are included in the repository. Head back to the terminal where you created the admin user account.

Expand Down
14 changes: 8 additions & 6 deletions app/public/cantusdata/helpers/scrapers/genre.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self):
def flush(self):
self.is_field_name = False
self.is_field_description = False
self.row_cell_count = 0
self.key = ""
self.value = ""
self.dictionary = {}
Expand All @@ -29,12 +30,12 @@ def retrieve_genres(self):
return ret

def handle_starttag(self, tag, attrs):
field_name = ("class", "views-field views-field-name")
field_description = ("class", "views-field views-field-description")
if tag == "tr":
self.row_cell_count = 0
if tag == "td":
if field_name in attrs:
if self.row_cell_count == 0:
self.is_field_name = True
elif field_description in attrs:
elif self.row_cell_count == 1:
self.is_field_description = True

def handle_endtag(self, tag):
Expand All @@ -47,17 +48,18 @@ def handle_endtag(self, tag):
self.dictionary[self.key.strip("[]")] = self.value
self.key = ""
self.value = ""
self.row_cell_count += 1

def handle_data(self, data):
if self.is_field_name:
if not data.isspace():
self.key = data
if self.is_field_description:
if not data.isspace():
self.value = data
self.value = data.strip()


genre_url = "http://cantus.uwaterloo.ca/genre"
genre_url = "https://cantusdatabase.org/genres"
contents = urllib.request.urlopen(genre_url).read().decode("utf-8")
parser = GenreScraper()
parser.feed(contents)
Expand Down
2 changes: 1 addition & 1 deletion app/public/cantusdata/helpers/scrapers/manuscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def handle_data(self, data):


def parse(url):
baseurl = "https://cantus.uwaterloo.ca"
baseurl = "https://cantusdatabase.org"
# url is relative? -> join, url is absolute? -> nothing should change
url = urljoin(baseurl, url)
contents = urllib.request.urlopen(url).read().decode("utf-8")
Expand Down
2 changes: 1 addition & 1 deletion app/public/cantusdata/helpers/scrapers/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def handle_starttag(self, tag, attrs):
self.dictionary[link] = title


sources_url = "http://cantus.uwaterloo.ca/sources"
sources_url = "https://cantusdatabase.org/sources"
contents = urllib.request.urlopen(sources_url).read().decode("utf-8")
parser = SourcesScraper()
parser.feed(contents)
Expand Down
22 changes: 5 additions & 17 deletions app/public/cantusdata/helpers/source_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,27 +115,15 @@ def extract_source_data(self, source_json):
:return: a dictionary of Manuscript attributes
"""
source_dict = {}
source_dict["id"] = source_json["vid"]
source_dict["id"] = source_json["id"]
source_dict["name"] = source_json["title"]
if source_json["field_siglum"]:
source_dict["siglum"] = source_json["field_siglum"]["und"][0]["value"]
else:
source_dict["siglum"] = ""
if source_json["field_date"]:
source_dict["date"] = source_json["field_date"]["und"][0]["value"]
else:
source_dict["date"] = ""
source_dict["siglum"] = source_json.get("siglum", "")
source_dict["date"] = source_json.get("date", "")
## See documentation of the download_source_provenance method for details
## on these commented lines.
# if source_json["field_provenance"]:
# source_dict["provenance"] = source_json["field_provenance"]["und"][0]["value"]
# else:
# source_dict["provenance"] = ""
# source_dict["provenance"] = source_json.get("provenance","")
source_dict["provenance"] = self.download_source_provenance(source_dict["id"])
if source_json["field_summary"]:
source_dict["description"] = source_json["field_summary"]["und"][0]["value"]
else:
source_dict["description"] = ""
source_dict["description"] = source_json.get("summary", "")
return source_dict

def get_source_data(self, source_id):
Expand Down
2 changes: 1 addition & 1 deletion app/public/cantusdata/management/commands/import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def handle(self, *args, **options):
@transaction.atomic
def import_manuscript_data(self, **options):
self.stdout.write("Starting manuscript import process.")
cdb_base_url = "https://cantus.uwaterloo.ca/"
cdb_base_url = "https://cantusdatabase.org"
source_importer = SourceImporter(cdb_base_url)
source_ids = source_importer.request_source_ids()
i = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class Command(BaseCommand):
"""Normalize chants exported from http://cantus.uwaterloo.ca for compatibility with the chant import script"""
"""Normalize chants exported from Cantus Database for compatibility with the chant import script"""

args = "filename.csv"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export default Marionette.ItemView.extend({
var formattedVolpiano = parseVolpianoSyllables(text, volpiano);
this.model.set('volpiano', formattedVolpiano);
var cdb_uri = this.model.get('cdb_uri');
this.model.set({ 'cdb_link_url': 'https://cantus.uwaterloo.ca/node/' + cdb_uri });
this.model.set({ 'cdb_link_url': 'https://cantusdatabase.org/chant/' + cdb_uri });
manuscriptChannel.on('chantAccordion:click',this.stopChantAudio, this);
},
ui : {
Expand Down

0 comments on commit d836bf0

Please sign in to comment.