aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-06-04 23:24:29 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-06-04 23:24:29 +0200
commit4040ee7add10e16027d8dd4cc07ce774dcb3effd (patch)
tree9b0d5d16f32eeca2990dd488aa5a30c1608daae4
parent7c86a299455fb44466b2a2896ca7fa4a8343c410 (diff)
downloadrefcat-4040ee7add10e16027d8dd4cc07ce774dcb3effd.tar.gz
refcat-4040ee7add10e16027d8dd4cc07ce774dcb3effd.zip
add: BrefZipOpenLibrary
-rw-r--r--python/refcat/tasks.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index 36250ba..c4e5b56 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -279,6 +279,7 @@ class OpenLibraryAuthors(luigi.ExternalTask, Refcat):
def output(self):
return luigi.LocalTarget(path=settings.OL_DUMP_AUTHORS, format=Zstd)
+
# ----8< Derivations
#
@@ -1039,6 +1040,31 @@ class UnmatchedOpenLibraryMatchTable(Refcat):
return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd)
+class BrefZipOpenLibrary(Refcat):
+ """
+ Export fuzzy matches to open library targets.
+ """
+ def requires(self):
+ return {
+ "unmatched": UnmatchedMapped(),
+ "ol": OpenLibraryEditionsMapped(),
+ }
+
+ def run(self):
+ output = shellout("""
+ skate-reduce -m oled
+ -O <(zstdcat -T0 {ol})
+ -F <(zstdcat -T0 {unmatched}) |
+ zstd -c > {output}
+ """,
+ ol=self.input().get("ol").path,
+ unmatched=self.input().get("unmatched").path)
+ luigi.LocalTarget(output).move(self.output().path)
+
+ def output(self):
+ return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd)
+
+
#
# Extra
# -----