1
0
mirror of https://github.com/kanzure/pdfparanoia.git synced 2024-12-04 23:15:52 +01:00

fix up verbose printouts, don't print out large data

This commit is contained in:
Zooko O'Whielacronx 2013-02-13 20:56:33 +00:00
parent 56cc7719da
commit 9204b2e17e
4 changed files with 12 additions and 9 deletions

View File

@ -44,9 +44,10 @@ class AmericanInstituteOfPhysics(Plugin):
#rawdata = copy(obj.rawdata) #rawdata = copy(obj.rawdata)
data = copy(obj.get_data()) data = copy(obj.get_data())
if "Redistribution subject to AIP license or copyright" in data: phrase="Redistribution subject to AIP license or copyright"
if phrase in data:
if verbose: if verbose:
sys.stderr.write("%s: Found object with %r; omitting..." % (cls.__name__, data,)) sys.stderr.write("%s: Found object %s with %r; omitting..." % (cls.__name__, objid, phrase,))
evil_ids.append(objid) evil_ids.append(objid)

View File

@ -38,9 +38,10 @@ class IEEEXplore(Plugin):
#rawdata = copy(obj.rawdata) #rawdata = copy(obj.rawdata)
data = copy(obj.get_data()) data = copy(obj.get_data())
if "Authorized licensed use limited to: " in data: phrase= "Authorized licensed use limited to: "
if phrase in data:
if verbose: if verbose:
sys.stderr.write("%s: Found object with %r; omitting..." % (cls.__name__, data,)) sys.stderr.write("%s: Found object %s with %r; omitting..." % (cls.__name__, objid, phrase,))
evil_ids.append(objid) evil_ids.append(objid)

View File

@ -61,6 +61,9 @@ class JSTOR(Plugin):
if all([requirement in data for requirement in JSTOR.requirements]): if all([requirement in data for requirement in JSTOR.requirements]):
better_content = data better_content = data
if verbose:
sys.stderr.write("%s: Found object %s with %r; omitting..." % (cls.__name__, objid, cls.requirements))
# remove the date # remove the date
startpos = better_content.find("This content downloaded ") startpos = better_content.find("This content downloaded ")
endpos = better_content.find(")", startpos) endpos = better_content.find(")", startpos)
@ -82,9 +85,6 @@ class JSTOR(Plugin):
startpos = better_content.rfind("/F2 11 Tf\n") startpos = better_content.rfind("/F2 11 Tf\n")
endpos = better_content.find("Tf\n", startpos+5) endpos = better_content.find("Tf\n", startpos+5)
if verbose:
sys.stderr.write("%s: Found object with %r; omitting..." % (cls.__name__, better_content[startpos:endpos],))
better_content = better_content[0:startpos] + better_content[endpos:] better_content = better_content[0:startpos] + better_content[endpos:]
replacements.append([objid, better_content]) replacements.append([objid, better_content])

View File

@ -40,9 +40,10 @@ class SPIE(Plugin):
if obj.attrs.has_key("Filter") and str(obj.attrs["Filter"]) == "/FlateDecode": if obj.attrs.has_key("Filter") and str(obj.attrs["Filter"]) == "/FlateDecode":
data = copy(obj.get_data()) data = copy(obj.get_data())
if "Downloaded From:" in data: phrase="Downloaded From:"
if phrase in data:
if verbose: if verbose:
sys.stderr.write("%s: found object with %r; omitting..." % (cls.__name__, data)) sys.stderr.write("%s: found object %s with %r; omitting..." % (cls.__name__, objid, phrase))
evil_ids.append(objid) evil_ids.append(objid)
for objid in evil_ids: for objid in evil_ids: