Ejemplo n.º 1
0
	def writeCIX(self, metadata):

		if metadata is not None:
			self.applyArchiveInfoToMetadata( metadata, calc_page_sizes=True )
			cix_string = ComicInfoXml().stringFromMetadata( metadata )
			write_success = self.archiver.writeArchiveFile( self.ci_xml_filename, cix_string )
			if write_success:
				self.has_cix = True
				self.cix_md = metadata
			self.resetCache()
			return write_success
		else:
			return False
Ejemplo n.º 2
0
    def readCIX(self):
        if self.cix_md is None:
            raw_cix = self.readRawCIX()
            if raw_cix is None or raw_cix == "":
                self.cix_md = GenericMetadata()
            else:
                self.cix_md = ComicInfoXml().metadataFromString(raw_cix)

            #validate the existing page list (make sure count is correct)
            if len(self.cix_md.pages) != 0:
                if len(self.cix_md.pages) != self.getNumberOfPages():
                    # pages array doesn't match the actual number of images we're seeing
                    # in the archive, so discard the data
                    self.cix_md.pages = []

            if len(self.cix_md.pages) == 0:
                self.cix_md.setDefaultPageList(self.getNumberOfPages())

        return self.cix_md