Changeset 387 for pkpgcounter/trunk

Show
Ignore:
Timestamp:
09/05/06 23:44:49 (18 years ago)
Author:
jerome
Message:

Code cleanups.

Location:
pkpgcounter/trunk
Files:
14 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/man/pkpgcounter.1

    r386 r387  
    22.TH PKPGCOUNTER "1" "September 2006" "C@LL - Conseil Internet & Logiciels Libres" "User Commands" 
    33.SH NAME 
    4 pkpgcounter \- manual page for pkpgcounter 1.85alpha 
     4pkpgcounter \- manual page for pkpgcounter 1.85 
    55.SH DESCRIPTION 
    6 pkpgcounter v1.85alpha (c) 2003, 2004, 2005, 2006 Jerome Alet 
     6pkpgcounter v1.85 (c) 2003, 2004, 2005, 2006 Jerome Alet 
    77.PP 
    88pkpgcounter is a generic Page Description Language parser. 
  • pkpgcounter/trunk/NEWS

    r383 r387  
    2222pkpgcounter News : 
    2323 
     24  * 1.85 : 
     25   
     26    - Added support for Samsung QPDL (aka SPL2) file format in page 
     27      counting mode, thanks to the work done by Aur�en Croc on 
     28      reverse engineering the file format. 
     29       
    2430  * 1.85alpha : 
    2531   
  • pkpgcounter/trunk/pkpgpdls/dvi.py

    r373 r387  
    3535    totiffcommand = 'cat >%(fname)s && dvips -q -o - %(fname)s | gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -' 
    3636    def isValid(self) :         
    37         """Returns 1 if data is DVI, else 0.""" 
     37        """Returns True if data is DVI, else False.""" 
    3838        try : 
    3939            if (ord(self.firstblock[0]) == 0xf7) and (ord(self.lastblock[-1]) == 0xdf) : 
    4040                self.logdebug("DEBUG: Input file is in the DVI format.") 
    41                 return 1 
     41                return True 
    4242            else :     
    43                 return 0 
     43                return False 
    4444        except IndexError :           
    45             return 0 
     45            return False 
    4646             
    4747    def getJobSize(self) : 
  • pkpgcounter/trunk/pkpgpdls/escp2.py

    r357 r387  
    3131    """A parser for ESC/P2 documents.""" 
    3232    def isValid(self) :         
    33         """Returns 1 if data is ESC/P2, else 0.""" 
     33        """Returns True if data is ESC/P2, else False.""" 
    3434        if self.firstblock.startswith("\033@") or \ 
    3535           self.firstblock.startswith("\033*") or \ 
     
    3737           self.firstblock.startswith("\0\0\0\033\1@EJL") : # ESC/P Raster ??? Seen on Stylus Photo 1284 
    3838            self.logdebug("DEBUG: Input file is in the ESC/P2 format.") 
    39             return 1 
     39            return True 
    4040        else :     
    41             return 0 
     41            return False 
    4242             
    4343    def getJobSize(self) :     
  • pkpgcounter/trunk/pkpgpdls/ooo.py

    r357 r387  
    3232    """A parser for OpenOffice.org documents.""" 
    3333    def isValid(self) :         
    34         """Returns 1 if data is DVI, else 0.""" 
     34        """Returns True if data is OpenDocument, else False.""" 
    3535        if self.firstblock[:2] == "PK" : 
    3636            try : 
     
    3939                self.metaxml = self.archive.read("meta.xml") 
    4040            except :     
    41                 return 0 
     41                return False 
    4242            else : 
    43                 self.logdebug("DEBUG: Input file is in the OpenOffice.org format.") 
    44                 return 1 
     43                self.logdebug("DEBUG: Input file is in the OpenDocument (ISO/IEC DIS 26300) format.") 
     44                return True 
    4545        else :     
    46             return 0 
     46            return False 
    4747             
    4848    def getJobSize(self) : 
  • pkpgcounter/trunk/pkpgpdls/pcl345.py

    r375 r387  
    8484         
    8585    def isValid(self) :     
    86         """Returns 1 if data is PCL, else 0.""" 
     86        """Returns True if data is PCL3/4/5, else False.""" 
    8787        if self.firstblock.startswith("\033E\033") or \ 
    8888           (self.firstblock.startswith("\033*rbC") and (not self.lastblock[-3:] == "\f\033@")) or \ 
     
    9292           (self.firstblock.startswith(chr(0xcd)+chr(0xca)) and self.firstblock.find("\033E\033")) : 
    9393            self.logdebug("DEBUG: Input file is in the PCL3/4/5 format.") 
    94             return 1 
     94            return True 
    9595        else :     
    96             return 0 
     96            return False 
    9797         
    9898    def setPageDict(self, pages, number, attribute, value) : 
  • pkpgcounter/trunk/pkpgpdls/pclxl.py

    r375 r387  
    8181             
    8282    def isValid(self) :     
    83         """Returns 1 if data is PCLXL aka PCL6, else 0.""" 
     83        """Returns True if data is PCLXL aka PCL6, else False.""" 
    8484        if ((self.firstblock[:128].find("\033%-12345X") != -1) and \ 
    8585             (self.firstblock.find(" HP-PCL XL;") != -1) and \ 
     
    8787              (self.firstblock.find("LANGUAGE = PCLXL") != -1))) : 
    8888            self.logdebug("DEBUG: Input file is in the PCLXL (aka PCL6) format.") 
    89             return 1 
     89            return True 
    9090        else :     
    91             return 0 
     91            return False 
    9292             
    9393    def beginPage(self, nextpos) : 
  • pkpgcounter/trunk/pkpgpdls/pdf.py

    r371 r387  
    4545    totiffcommand = 'gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -' 
    4646    def isValid(self) :     
    47         """Returns 1 if data is PDF, else 0.""" 
     47        """Returns True if data is PDF, else False.""" 
    4848        if self.firstblock.startswith("%PDF-") or \ 
    4949           self.firstblock.startswith("\033%-12345X%PDF-") or \ 
     
    5151           (self.firstblock.find("%PDF-") != -1) : 
    5252            self.logdebug("DEBUG: Input file is in the PDF format.") 
    53             return 1 
     53            return True 
    5454        else :     
    55             return 0 
     55            return False 
    5656         
    5757    def getJobSize(self) :     
  • pkpgcounter/trunk/pkpgpdls/pdlparser.py

    r371 r387  
    7878             
    7979    def isValid(self) :     
    80         """Returns 1 if data is in the expected format, else 0.""" 
     80        """Returns True if data is in the expected format, else False.""" 
    8181        raise RuntimeError, "Not implemented !" 
    8282         
  • pkpgcounter/trunk/pkpgpdls/postscript.py

    r384 r387  
    3636    totiffcommand = 'gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -' 
    3737    def isValid(self) :     
    38         """Returns 1 if data is PostScript, else 0.""" 
     38        """Returns True if data is PostScript, else False.""" 
    3939        if self.firstblock.startswith("%!") or \ 
    4040           self.firstblock.startswith("\004%!") or \ 
     
    4646              (self.firstblock.find("%!PS-Adobe") != -1) : 
    4747            self.logdebug("DEBUG: Input file is in the PostScript format.") 
    48             return 1 
     48            return True 
    4949        else :     
    50             return 0 
     50            return False 
    5151         
    5252    def throughGhostScript(self) : 
  • pkpgcounter/trunk/pkpgpdls/qpdl.py

    r386 r387  
    7373             
    7474    def isValid(self) :     
    75         """Returns 1 if data is PCLXL aka PCL6, else 0.""" 
     75        """Returns True if data is QPDL aka SPL2, else False.""" 
    7676        if ((self.firstblock[:128].find("\033%-12345X") != -1) and \ 
    7777             ((self.firstblock.find("LANGUAGE=QPDL") != -1) or \ 
    7878              (self.firstblock.find("LANGUAGE = QPDL") != -1))) : 
    7979            self.logdebug("DEBUG: Input file is in the QPDL (aka SPL2) format.") 
    80             return 1 
     80            return True 
    8181        else :     
    82             return 0 
     82            return False 
    8383             
    8484    def beginPage(self, nextpos) : 
  • pkpgcounter/trunk/pkpgpdls/tiff.py

    r372 r387  
    3535    totiffcommand = "cat >%(fname)s" 
    3636    def isValid(self) :         
    37         """Returns 1 if data is TIFF, else 0.""" 
     37        """Returns True if data is TIFF, else False.""" 
    3838        littleendian = (chr(0x49)*2) + chr(0x2a) + chr(0) 
    3939        bigendian = (chr(0x4d)*2) + chr(0) + chr(0x2a) 
    4040        if self.firstblock[:4] in (littleendian, bigendian) : 
    4141            self.logdebug("DEBUG: Input file is in the TIFF format.") 
    42             return 1 
     42            return True 
    4343        else :     
    44             return 0 
     44            return False 
    4545     
    4646    def getJobSize(self) : 
  • pkpgcounter/trunk/pkpgpdls/version.py

    r383 r387  
    2323 
    2424 
    25 __version__ = "1.85alpha" 
     25__version__ = "1.85" 
    2626 
    2727__doc__ = """pkpgcounter : a generic Page Description Languages parser.""" 
  • pkpgcounter/trunk/pkpgpdls/zjstream.py

    r385 r387  
    3434    """A parser for ZjStream documents.""" 
    3535    def isValid(self) :     
    36         """Returns 1 if data is ZjStream, else 0.""" 
     36        """Returns True if data is ZjStream, else False.""" 
    3737        if self.firstblock[:4] == "ZJZJ" : 
    3838            self.logdebug("DEBUG: Input file is in the Zenographics ZjStream (little endian) format.") 
    3939            self.littleEndian() 
    40             return 1 
     40            return True 
    4141        elif self.firstblock[:4] == "JZJZ" :     
    4242            self.logdebug("DEBUG: Input file is in the Zenographics ZjStream (big endian) format.") 
    4343            self.bigEndian() 
    44             return 1 
     44            return True 
    4545        else :     
    46             return 0 
     46            return False 
    4747         
    4848    def littleEndian(self) :