aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-07-31 15:23:17 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-03 10:50:14 -0700
commit99e67b079f8d3267e9bbd53bbdb9cf729be61d87 (patch)
treeb05497d76de44ebbe02ab3b09f10b99bb41e3c87
parent942d0243c8bb718a39a9d0f2fbfa911ce7c27443 (diff)
downloadchocula-99e67b079f8d3267e9bbd53bbdb9cf729be61d87.tar.gz
chocula-99e67b079f8d3267e9bbd53bbdb9cf729be61d87.zip
directories: all extra metadata in top-level dict
Had been using slug-specific sub-objects, but this was too confusing.
-rw-r--r--chocula/database.py10
-rw-r--r--chocula/directories/norwegian.py4
-rw-r--r--chocula/directories/sherpa_romeo.py2
-rw-r--r--chocula/directories/szczepanski.py6
4 files changed, 9 insertions, 13 deletions
diff --git a/chocula/database.py b/chocula/database.py
index f30ceb5..0820e0f 100644
--- a/chocula/database.py
+++ b/chocula/database.py
@@ -511,15 +511,11 @@ class ChoculaDatabase:
out["lang"] = extra["langs"][0]
if irow["slug"] in ("doaj", "road", "szczepanski", "gold_oa"):
out["is_oa"] = True
- if irow["slug"] == "ezb":
- ezb_extra = json.loads(irow["extra"])
- if ezb_extra["ezb_color"] == "green":
- out["is_oa"] = True
if irow["slug"] == "sherpa_romeo":
extra = json.loads(irow["extra"])
- if extra.get("sherpa_romeo"):
- out["sherpa_color"] = extra["sherpa_romeo"]["color"]
- if extra["sherpa_romeo"].get("color") == "green":
+ if extra.get("color"):
+ out["sherpa_color"] = extra["color"]
+ if extra["color"] == "green":
out["is_oa"] = True
# filter out "NA" ISSNs
diff --git a/chocula/directories/norwegian.py b/chocula/directories/norwegian.py
index 8bfa19a..74167a0 100644
--- a/chocula/directories/norwegian.py
+++ b/chocula/directories/norwegian.py
@@ -67,9 +67,9 @@ class NorwegianLoader(DirectoryLoader):
langs=[lang for lang in [parse_lang(row["Language"])] if lang],
)
- info.extra["norwegian"] = dict(as_of=self.config.norwegian.date)
+ info.extra["as_of"] = self.config.norwegian.date
if row["Level 2019"]:
- info.extra["norwegian"]["level"] = int(row["Level 2019"])
+ info.extra["level"] = int(row["Level 2019"])
if row["Original title"] != row["International title"]:
info.original_name = clean_str(row["Original title"])
diff --git a/chocula/directories/sherpa_romeo.py b/chocula/directories/sherpa_romeo.py
index a8ba1b0..5618302 100644
--- a/chocula/directories/sherpa_romeo.py
+++ b/chocula/directories/sherpa_romeo.py
@@ -58,6 +58,6 @@ class SherpaRomeoLoader(DirectoryLoader):
)
if row["RoMEO colour"]:
- info.extra["sherpa_romeo"] = dict(color=row["RoMEO colour"])
+ info.extra["color"] = row["RoMEO colour"]
return info
diff --git a/chocula/directories/szczepanski.py b/chocula/directories/szczepanski.py
index 3586acb..88e35a8 100644
--- a/chocula/directories/szczepanski.py
+++ b/chocula/directories/szczepanski.py
@@ -33,12 +33,12 @@ class SzczepanskiLoader(DirectoryLoader):
publisher=clean_str(row.get("ed")),
)
- info.extra["szczepanski"] = dict(as_of=self.config.szczepanski.date)
+ info.extra["as_of"] = self.config.szczepanski.date
if row.get("extra"):
- info.extra["szczepanski"]["notes"] = row.get("extra")
+ info.extra["notes"] = row.get("extra")
for k in ("other_titles", "year_spans", "ed"):
if row.get(k):
- info.extra["szczepanski"][k] = row[k]
+ info.extra[k] = row[k]
url = HomepageUrl.from_url(row.get("url"))
if url: