From 7f0bcf56425361b17397c5b7457a82ddec147cbd Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 28 Apr 2021 23:34:49 +0200 Subject: add WithISBN task --- python/refcat/tasks.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 39565ff..6893cb1 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -1426,3 +1426,25 @@ class RefsSortedIdent(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd) + +# OL + +class WithISBN(Refcat): + """ + Keeps converted refs with isbn. + """ + def requires(self): + return RefsToRelease() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + parallel -j {n} --block 10M --pipe "jq -rc 'select(.ext_ids.isbn != null)" | + zstd -T0 -c > {output} + """, + tmpdir=self.tmpdir, + input=self.input().path) + luigi.LocalTarget(output).move(self.output().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd) -- cgit v1.2.3