diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-04-28 23:34:49 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-04-28 23:34:49 +0200 |
commit | 7f0bcf56425361b17397c5b7457a82ddec147cbd (patch) | |
tree | c914e2ac7ba9525af9070c193ea2713a03524a63 | |
parent | 1e111eed2500db175ac4c2132822276485e4b4a4 (diff) | |
download | refcat-7f0bcf56425361b17397c5b7457a82ddec147cbd.tar.gz refcat-7f0bcf56425361b17397c5b7457a82ddec147cbd.zip |
add WithISBN task
-rw-r--r-- | python/refcat/tasks.py | 22 |
1 files changed, 22 insertions, 0 deletions
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) |