From 75f987f897ea7dc4a8c2f3047d547ce4997220ad Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 26 May 2021 23:36:09 +0200 Subject: tasks: OpenLibraryRelease --- python/refcat/tasks.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'python') diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 4880f43..c45b6ed 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -748,6 +748,23 @@ class OpenLibraryWorksSorted(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) +class OpenLibraryRelease(Refcat): + """ + Turn Open Library into Release Entities with author mapping. + """ + def run(self): + # TODO: remove hardcoded values. + output = shellout(""" + zstdcat -T0 /magna/data/ol_dump_editions_latest.txt.zst | + cut -f5 | + skate-conv -f oled -Xa <(zstdcat -T0 /magna/data/ol_author_mapping.tsv.zst) + """ + luigi.LocalTarget(output).move(self.output().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd) + + class UnmatchedMapped(Refcat): """ Map unmatched refs (in release schema) to titles to do approximate title @@ -770,3 +787,4 @@ class UnmatchedMapped(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) + -- cgit v1.2.3