Skip to content

Commit

Permalink
Fix scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloCastellano committed Apr 25, 2016
1 parent 66fbdfe commit b082491
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scripts/borme_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# borme_info.py -
# Copyright (C) 2015 Pablo Castellano <pablo@anche.no>
# Copyright (C) 2015-2016 Pablo Castellano <pablo@anche.no>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -33,7 +33,7 @@
bormeparser.borme.logger.setLevel(logging.DEBUG)
bormeparser.backends.pypdf2.functions.logger.setLevel(logging.DEBUG) # FIXME: DEFAULT_PARSER

borme = bormeparser.parse(sys.argv[1])
borme = bormeparser.parse(sys.argv[1], bormeparser.SECCION.A)

for anuncio in borme.get_anuncios():
print('Anuncio %d' % anuncio.id)
Expand Down
4 changes: 2 additions & 2 deletions scripts/borme_info_num.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# borme_info_num.py -
# Copyright (C) 2015 Pablo Castellano <pablo@anche.no>
# Copyright (C) 2015-2016 Pablo Castellano <pablo@anche.no>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -35,7 +35,7 @@
bormeparser.borme.logger.setLevel(logging.DEBUG)
bormeparser.backends.pypdf2.functions.logger.setLevel(logging.DEBUG) # FIXME: DEFAULT_PARSER

borme = bormeparser.parse(sys.argv[1])
borme = bormeparser.parse(sys.argv[1], bormeparser.SECCION.A)

for id in sys.argv[2].split(','):
try:
Expand Down
6 changes: 3 additions & 3 deletions scripts/borme_json_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# borme_json_all.py -
# Copyright (C) 2015 Pablo Castellano <pablo@anche.no>
# Copyright (C) 2015-2016 Pablo Castellano <pablo@anche.no>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -49,7 +49,7 @@ def run(self):
pdf_path, json_path = self.queue.get()
print('Creating %s...' % json_path)
try:
borme = bormeparser.parse(pdf_path)
borme = bormeparser.parse(pdf_path, bormeparser.SECCION.A)
borme.to_json(json_path)
print('{cve}: OK'.format(cve=borme.cve))
except Exception as e:
Expand Down Expand Up @@ -85,7 +85,7 @@ def run(self):
os.makedirs(json_day_dir, exist_ok=True) # TODO: Python 2
_, _, files = next(os.walk(day_dir))
for filename in files:
if filename.endswith('-99.pdf'):
if not filename.endswith('.pdf') or filename.endswith('-99.pdf'):
continue
pdf_path = os.path.join(day_dir, filename)
json_filename = filename.replace('.pdf', '.json')
Expand Down

0 comments on commit b082491

Please sign in to comment.