Logo Search packages:      
Sourcecode: rapid-photo-downloader version File versions  Download package

def rapid::metadata::MetaData::shortCameraModel (   self,
  includeCharacters = '',
  missing = '' 
)

Returns in shorterned string format the camera model used to record the image.

Returns missing if the metadata value is not present.

The short format is determined by the first occurrence of a digit in the 
camera model, including all alphaNumeric characters before and after 
that digit up till a non-alphanumeric character, but with these interventions:

1. Canon "Mark" designations are shortened prior to conversion.
2. Names like "Canon EOS DIGITAL REBEL XSi" do not have a number and must
    and treated differently (see below)

Examples:
Canon EOS 300D DIGITAL -> 300D
Canon EOS 5D -> 5D
Canon EOS 5D Mark II -> 5DMkII
NIKON D2X -> D2X
NIKON D70 -> D70
X100,D540Z,C310Z -> X100
Canon EOS DIGITAL REBEL XSi -> XSi
Canon EOS Digital Rebel XS -> XS
Canon EOS Digital Rebel XTi -> XTi
Canon EOS Kiss Digital X -> Digital
Canon EOS Digital Rebel XT -> XT
EOS Kiss Digital -> Digital        
Canon Digital IXUS Wireless -> Wireless
Canon Digital IXUS i zoom -> zoom
Canon EOS Kiss Digital N -> N
Canon Digital IXUS IIs -> IIs
IXY Digital L -> L
Digital IXUS i -> i
IXY Digital -> Digital
Digital IXUS -> IXUS

The optional includeCharacters allows additional characters to appear 
before and after the digits. 
Note: special includeCharacters MUST be escaped as per syntax of a 
regular expressions (see documentation for module re)
       
Examples:

includeCharacters = '':
DSC-P92 -> P92 
includeCharacters = '\-':
DSC-P92 -> DSC-P92 

If a digit is not found in the camera model, the last word is returned.

Note: assume exif values are in ENGLISH, regardless of current platform

Reimplemented in rapid::metadata::DummyMetaData.

Definition at line 309 of file metadata.py.

00309                                                                   :
        """ 
        Returns in shorterned string format the camera model used to record the image.
        
        Returns missing if the metadata value is not present.
        
        The short format is determined by the first occurrence of a digit in the 
        camera model, including all alphaNumeric characters before and after 
        that digit up till a non-alphanumeric character, but with these interventions:
        
        1. Canon "Mark" designations are shortened prior to conversion.
        2. Names like "Canon EOS DIGITAL REBEL XSi" do not have a number and must
            and treated differently (see below)
        
        Examples:
        Canon EOS 300D DIGITAL -> 300D
        Canon EOS 5D -> 5D
        Canon EOS 5D Mark II -> 5DMkII
        NIKON D2X -> D2X
        NIKON D70 -> D70
        X100,D540Z,C310Z -> X100
        Canon EOS DIGITAL REBEL XSi -> XSi
        Canon EOS Digital Rebel XS -> XS
        Canon EOS Digital Rebel XTi -> XTi
        Canon EOS Kiss Digital X -> Digital
        Canon EOS Digital Rebel XT -> XT
        EOS Kiss Digital -> Digital        
        Canon Digital IXUS Wireless -> Wireless
        Canon Digital IXUS i zoom -> zoom
        Canon EOS Kiss Digital N -> N
        Canon Digital IXUS IIs -> IIs
        IXY Digital L -> L
        Digital IXUS i -> i
        IXY Digital -> Digital
        Digital IXUS -> IXUS
        
        The optional includeCharacters allows additional characters to appear 
        before and after the digits. 
        Note: special includeCharacters MUST be escaped as per syntax of a 
        regular expressions (see documentation for module re)
       
        Examples:
        
        includeCharacters = '':
        DSC-P92 -> P92 
        includeCharacters = '\-':
        DSC-P92 -> DSC-P92 
        
        If a digit is not found in the camera model, the last word is returned.
        
        Note: assume exif values are in ENGLISH, regardless of current platform
        """
        m = self.cameraModel()
        m = m.replace(' Mark ', 'Mk') 
        if m:
            s = r"(?:[^a-zA-Z0-9%s]?)(?P<model>[a-zA-Z0-9%s]*\d+[a-zA-Z0-9%s]*)"\
                % (includeCharacters, includeCharacters, includeCharacters)
            r = re.search(s, m)
            if r:
                return r.group("model")
            else:
                head,  space,  model = m.strip().rpartition(' ')
                return model
        else:
            return missing
    
    def filterMangledDates(self, d):


Generated by  Doxygen 1.6.0   Back to index