aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-06-07 19:19:25 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-06-07 19:19:25 +0200
commitfda10154b50ab44970d2841e0ea74a4651b7b920 (patch)
tree1996d3fea215e88bcfd08fe21031d40c49aed055
parentaa16994de8efc3c49fe79a9470ef1da22330bd67 (diff)
downloadrefcat-fda10154b50ab44970d2841e0ea74a4651b7b920.tar.gz
refcat-fda10154b50ab44970d2841e0ea74a4651b7b920.zip
task: add OpenLibraryReleaseMapped
-rw-r--r--python/refcat/tasks.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index 75e40b5..88d4473 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -1116,6 +1116,26 @@ class BrefZipOpenLibrary(Refcat):
def output(self):
return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd)
+class OpenLibraryReleaseMapped(Refcat):
+ mapper = luigi.Parameter(default="isbn", description="mapper short name")
+
+ def requires(self):
+ return OpenLibraryEditionsToRelease()
+
+ def run(self):
+ output = shellout("""
+ zstdcat -T0 {input} |
+ skate-map -m {mapper} -skip-on-empty 1 |
+ LC_ALL=C sort -T {tmpdir} -k1,1 -S25% --parallel 4 |
+ zstd -T0 -c > {output}
+ """,
+ mapper=self.mapper,
+ tmpdir=self.tmpdir,
+ input=self.input().path)
+ luigi.LocalTarget(output).move(self.output().path)
+
+ def output(self):
+ return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd)
#
# Combined Bref File