Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions updatesearch/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ class UpdateSearch(object):
"""

def __init__(self, period=None, from_date=None, until_date=None,
collection=None, issn=None, delete=False, differential=False,
load_indicators=False):
collection=None, network=None, issn=None, delete=False,
differential=False, load_indicators=False):
self.delete = delete
self.collection = collection
self.network = network
self.from_date = from_date
self.until_date = until_date
self.differential = differential
Expand Down Expand Up @@ -157,6 +158,13 @@ def pipeline_to_xml(self, article):
add = ET.Element('add')

for xml in xmls:
if self.network:
# Add field network passed by argument
field_network = ET.Element('field')
field_network.text = self.network
field_network.set('name', 'network')
xml.find('.').append(field_network)

add.append(xml)

return ET.tostring(add, encoding="utf-8", method="xml")
Expand Down Expand Up @@ -358,6 +366,12 @@ def main():
help='use the acronym of the collection eg.: spa, scl, col.'
)

parser.add_argument(
'-w', '--network',
default=None,
help='use to mark articles with specific network. eg.: rve, org.'
)

parser.add_argument(
'-i', '--issn',
default=None,
Expand Down Expand Up @@ -394,6 +408,7 @@ def main():
from_date=args.from_date,
until_date=args.until_date,
collection=args.collection,
network=args.network,
issn=args.issn,
delete=args.delete,
differential=args.differential,
Expand Down