def parse_metadata(self):
        data = self._get_raw_metadata(self.file.path)

        for key, val in data.items():
            if isinstance(val, basestring):
                data[key] = super_force_ascii(val)

        self.metadata = Metadata(data)
Beispiel #2
0
    def parse_metadata(self):
        super(Image, self).parse_metadata()

        self.width = self.metadata["Image width"]
        self.height = self.metadata["Image height"]
        self.one_off_author = self.metadata["Author"] or self.metadata["80"] or ""
        if isinstance(self.one_off_author, (tuple, list)):
            self.one_off_author = ", ".join(self.one_off_author)
        if not self.caption:
            self.caption = self.metadata["120"] or self.metadata["Title"] or ""
        tags = []
        tags.extend(self.metadata["15"] or [])
        tags.extend(self.metadata["20"] or [])
        tags.extend(self.metadata["25"] or [])
        categories = ", ".join([x[:50] for x in tags])
        self.categories = super_force_ascii(categories)
    def parse_metadata(self):
        super(Image, self).parse_metadata()

        self.width = self.metadata['Image width']
        self.height = self.metadata['Image height']
        self.one_off_author = self.metadata['Author'] or self.metadata[
            '80'] or ''
        if isinstance(self.one_off_author, (tuple, list)):
            self.one_off_author = ", ".join(self.one_off_author)
        if not self.caption:
            self.caption = self.metadata['120'] or self.metadata['Title'] or ''
        tags = []
        tags.extend(self.metadata["15"] or [])
        tags.extend(self.metadata["20"] or [])
        tags.extend(self.metadata["25"] or [])
        categories = ", ".join([x[:50] for x in tags])
        self.categories = super_force_ascii(categories)