www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 0284e5339b0e42685b1807a800618e4bd17cfe8d
parent 3fd346ed069ba4109c247ca77c724995ddf51a90
Author: Simon Kornblith <simon@simonster.com>
Date:   Tue,  9 Sep 2008 16:03:37 +0000

remove cache file even when it is < 20 lines long


Diffstat:
Mchrome/content/zotero/recognizePDF.js | 32+++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js @@ -292,25 +292,27 @@ Zotero_RecognizePDF.Recognizer.prototype.recognize = function(file, callback, ca var lineLengthsLength = lineLengths.length; if(lineLengthsLength < 20) { this._callback(false, "recognizePDF.noOCR"); - return; - } - - var sortedLengths = lineLengths.sort(); - var medianLength = sortedLengths[Math.floor(lineLengthsLength/2)]; - - // pick lines within 4 chars of the median (this is completely arbitrary) - this._goodLines = []; - var uBound = medianLength + 4; - var lBound = medianLength - 4; - for (var i=0; i<lineLengthsLength; i++) { - if(lineLengths[i] > lBound && lineLengths[i] < uBound) this._goodLines.push(lines[i]); + } else { + var sortedLengths = lineLengths.sort(); + var medianLength = sortedLengths[Math.floor(lineLengthsLength/2)]; + + // pick lines within 4 chars of the median (this is completely arbitrary) + this._goodLines = []; + var uBound = medianLength + 4; + var lBound = medianLength - 4; + for (var i=0; i<lineLengthsLength; i++) { + if(lineLengths[i] > lBound && lineLengths[i] < uBound) this._goodLines.push(lines[i]); + } + + this._startLine = this._iteration = 0; } - this._startLine = this._iteration = 0; - inputStream.close(); cacheFile.remove(false); - this._queryGoogle(); + + if(lineLengthsLength >= 20) { + this._queryGoogle(); + } } /**