示例#1
0
 def useFile(self, field):
     meta = Metadata(self)
     meta.filename = field["filename"].value
     meta.file_size = field["filesize"].value
     meta.creation_date = field["timestamp"].value
     attr = field["attributes"].value
     if attr != "(none)":
         meta.file_attr = attr
     if meta.has("filename"):
         title = "File \"%s\"" % meta.getText('filename')
     else:
         title = "File"
     self.addGroup(field.name, meta, title)
示例#2
0
 def extract(self, tar):
     max_nb = maxNbFile(self)
     for index, field in enumerate(tar.array("file")):
         if max_nb is not None and max_nb <= index:
             self.warning("TAR archive contains many files, "
                          "but only first %s files are processed"
                          % max_nb)
             break
         meta = Metadata(self)
         self.extractFile(field, meta)
         if meta.has("filename"):
             title = 'File "%s"' % meta.getText('filename')
         else:
             title = "File"
         self.addGroup(field.name, meta, title)
示例#3
0
 def extract(self, mar):
     self.comment = "Contains %s files" % mar["nb_file"].value
     self.format_version = ("Microsoft Archive version %s"
                            % mar["version"].value)
     max_nb = maxNbFile(self)
     for index, field in enumerate(mar.array("file")):
         if max_nb is not None and max_nb <= index:
             self.warning("MAR archive contains many files, "
                          "but only first %s files are processed"
                          % max_nb)
             break
         meta = Metadata(self)
         meta.filename = field["filename"].value
         meta.compression = "None"
         meta.file_size = field["filesize"].value
         self.addGroup(field.name, meta,
                       "File \"%s\"" % meta.getText('filename'))