File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,22 @@ def run(self):
67
67
self .logger .debug ('Reading file %s ...' % (self .input .name , ))
68
68
69
69
content = etree .parse (self .input )
70
- self .writer = csv .writer (self .output )
70
+ if self .output :
71
+ self .writer = csv .writer (self .output )
71
72
for elem in content .iter (PAGE ):
72
73
self .processPage (elem )
73
74
74
75
self .logger .info ('Processed %d pages ...' % (self .pages , ))
75
76
self .logger .info ('Processed %d lines ...' % (self .total_lines , ))
76
77
78
+ def processResults (self , lines ):
79
+ '''
80
+ Process results and place them in CSV.
81
+
82
+ Override this method to do other things with the results.
83
+ '''
84
+ self .writer .writerows (lines )
85
+
77
86
def analyzeCoverPage (self , objs ):
78
87
'''
79
88
Analyze a portrait page, which is probably a cover.
@@ -268,7 +277,7 @@ def processPage(self, page):
268
277
else :
269
278
lines = self .analyzePage (page_objs )
270
279
271
- self .writer . writerows (lines )
280
+ self .processResults (lines )
272
281
273
282
self .logger .info (' Max columns: %d' % (max (len (x ) for x in lines )))
274
283
self .logger .info (' New rows: %d' % (len (lines )))
You can’t perform that action at this time.
0 commit comments