parameters: (filepath)
docstring: Get the date and time from a raw jpeg file.
docstring_summary: Get the date and time from a raw jpeg file.
docstring_tokens: Get the date and time from a raw jpeg file .
function: def getJpegDateTime(filepath):
      '''Get the date and time from a raw jpeg file.'''
      
      # TODO: For some files it is probably in the name.
      
      # Use this tool to extract the metadata
      cmd      = [asp_system_utils.which('gdalinfo'), filepath]
      p        = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
      out, err = p.communicate()
      
      lines = out.split('\n')
  
      for line in lines:
          if 'EXIF_DateTimeOriginal' not in line:
              continue
          parts = line.replace('=',' ').split()
          dateString = parts[1].strip().replace(':','')
          timeString = parts[2].strip().replace(':','')
          
          return (dateString, timeString)
  
      raise Exception('Failed to read date/time from file: ' + filepath)
function_tokens: def getJpegDateTime ( filepath ) : # TODO: For some files it is probably in the name. # Use this tool to extract the metadata cmd = [ asp_system_utils . which ( 'gdalinfo' ) , filepath ] p = subprocess . Popen ( cmd , stdout = subprocess . PIPE , universal_newlines = True ) out , err = p . communicate ( ) lines = out . split ( '\n' ) for line in lines : if 'EXIF_DateTimeOriginal' not in line : continue parts = line . replace ( '=' , ' ' ) . split ( ) dateString = parts [ 1 ] . strip ( ) . replace ( ':' , '' ) timeString = parts [ 2 ] . strip ( ) . replace ( ':' , '' ) return ( dateString , timeString ) raise Exception ( 'Failed to read date/time from file: ' + filepath )