only run on collection
This commit is contained in:
parent
24685b853e
commit
7049589f0e
1 changed files with 10 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
import re
|
||||
import sys
|
||||
|
||||
import ox
|
||||
import ox.api
|
||||
|
@ -7,6 +8,14 @@ import ox.api
|
|||
site = 'archive.leftove.rs'
|
||||
api = ox.api.signin('https://%s/api/' % site)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
collection = sys.argv[1]
|
||||
conditions = [
|
||||
{'key': 'collection', 'operator': '==', 'value': collection}
|
||||
]
|
||||
else:
|
||||
conditions = []
|
||||
|
||||
for regex, fragments in (
|
||||
['Vol. \d+, No. \d+', ['Vol.', 'No.']],
|
||||
['Vol \d+ no \d+', [' Vol ', ' no ']],
|
||||
|
@ -17,7 +26,7 @@ for regex, fragments in (
|
|||
'conditions': [
|
||||
{'key': 'title', 'operator': '=', 'value': fragment}
|
||||
for fragment in fragments
|
||||
],
|
||||
] + conditions,
|
||||
'operator': '&'
|
||||
},
|
||||
'keys': ['id', 'title', 'volume'],
|
||||
|
|
Loading…
Reference in a new issue