Esempio n. 1
0
 def create_file(self, filePath, fileName):
   file = File()
   file.name = fileName
   file.relPath = os.path.normpath(os.path.relpath(filePath, self.root))
   file.originalPath = os.path.normpath(os.path.join(filePath, fileName))
   t = os.path.getmtime(file.originalPath)
   file.mTime = datetime.datetime.fromtimestamp(t)
   t = os.path.getctime(file.originalPath)
   file.cTime = datetime.datetime.fromtimestamp(t)
   file.size = os.path.getsize(file.originalPath)
   _, fileExtension = os.path.splitext(file.originalPath)
   file.type = File.type_from_extension(fileExtension)
   if file.type == fileConstants.TYPE_OTHER or file.type == fileConstants.TYPE_UNKNOWN:
     return None
   self.update_exif_metadata(file)
   file.file_type = fileConstants.TYPE_FILESYSTEM
   return file