Changeset 3436 for pkpgcounter/trunk/pkpgpdls/mscrap.py
- Timestamp:
- 10/06/08 00:22:07 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/mscrap.py
r3410 r3436 8 8 # the Free Software Foundation, either version 3 of the License, or 9 9 # (at your option) any later version. 10 # 10 # 11 11 # This program is distributed in the hope that it will be useful, 12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 # GNU General Public License for more details. 15 # 15 # 16 16 # You should have received a copy of the GNU General Public License 17 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. … … 33 33 required = [ "xvfb-run", "xauth", "abiword", "gs" ] 34 34 format = "Microsoft shitty" 35 def isValid(self) : 35 def isValid(self) : 36 36 """Returns True if data is MS crap, else False. 37 37 38 38 Identifying datas taken from the file command's magic database. 39 39 IMPORTANT : some magic values are not reused here because they 40 40 IMPORTANT : seem to be specific to some particular i18n release. 41 """ 41 """ 42 42 if self.firstblock.startswith("PO^Q`") \ 43 43 or self.firstblock.startswith("\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1") \ … … 49 49 if self.isMissing(self.required) : 50 50 return False 51 else : 51 else : 52 52 return True 53 else : 53 else : 54 54 return False 55 55 56 56 def getJobSize(self) : 57 57 """Counts pages in a Microsoft Word (r) (tm) (c) (etc...) document. … … 71 71 (first, last) = self.parent.readFirstAndLastBlocks(psinputfile) 72 72 import postscript 73 return postscript.Parser(self.parent, 74 outfname, 73 return postscript.Parser(self.parent, 74 outfname, 75 75 (first, last)).getJobSize() 76 76 finally : 77 77 psinputfile.close() 78 finally : 78 finally : 79 79 workfile.close() 80 80 raise pdlparser.PDLParserError, "Impossible to count pages in %(infname)s" % locals()