How to use the pyexiv2.ExifTag function in pyexiv2

To help you get started, we’ve selected a few pyexiv2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gramps-project / addons-source / EditExifMetadata / editexifmetadata.py View on Github external
def _set_value(plugininstance, key, widget_value):
    """
    sets the value for the metadata keys
    """
    if not plugininstance:
        return False
    valid = 0
    try:
        if OLD_API:
            plugininstance[key] = widget_value
            valid = 1
        else:
            plugininstance[key].value = widget_value
            valid = 2
    except KeyError:
        plugininstance[key] = pyexiv2.ExifTag(key, widget_value)
        valid = 3
    except (ValueError, AttributeError):
        valid = 4
    return valid
github gramps-project / addons-source / EditExifMetadata / editexifmetadata.py View on Github external
def _set_value(plugininstance, key, widget_value):
    """
    sets the value for the metadata keys
    """
    if not plugininstance:
        return False
    valid = 0
    try:
        if OLD_API:
            plugininstance[key] = widget_value
            valid = 1
        else:
            plugininstance[key].value = widget_value
            valid = 2
    except KeyError:
        plugininstance[key] = pyexiv2.ExifTag(key, widget_value)
        valid = 3
    except (ValueError, AttributeError):
        valid = 4
    return valid
github spillz / picty / modules / picty / metadata / metadata2.py View on Github external
def __setitem__(self,key,value):
        try:
            pyexiv2.ImageMetadata.__setitem__(self,key,value)
        except TypeError:
            if key.startswith('Exif'):
                value=pyexiv2.ExifTag(key,value)
            elif key.startswith('Iptc'):
                value=pyexiv2.IptcTag(key,value)
            elif key.startswith('Xmp'):
                value=pyexiv2.XmpTag(key,value)
            pyexiv2.ImageMetadata.__setitem__(self,key,value)
github gramps-project / addons-source / contrib / ImageMetadataGramplet / ImageMetadataGramplet.py View on Github external
def _set_exif_KeyTag(self, KeyTag, KeyValue):
        """
        sets the value for the metadata KeyTags
        """

        if LesserVersion:
            self.plugin_image[KeyTag] = KeyValue

        else:
            try:  # tag is being modified...
                self.plugin_image[KeyTag] = KeyValue

            except KeyError:  # tag has not been set...
                self.plugin_image[KeyTag] = pyexiv2.ExifTag(KeyTag, KeyValue)

            except (ValueError, AttributeError):  # there is an issue with either KeyTag or KeyValue
                pass
github gramps-project / gramps / gramps / plugins / gramplet / editexifmetadata.py View on Github external
def _set_value(plugininstance, key, widget_value):
    """
    sets the value for the metadata keys
    """
    if not plugininstance:
        return False
    valid = 0
    try:
        if OLD_API:
            plugininstance[key] = widget_value
            valid = 1
        else:
            plugininstance[key].value = widget_value
            valid = 2
    except KeyError:
        plugininstance[key] = pyexiv2.ExifTag(key, widget_value)
        valid = 3
    except (ValueError, AttributeError):
        valid = 4
    return valid
github gramps-project / addons-source / contrib / ImageMetadataGramplet / ImageMetadataGramplet.py View on Github external
    @param: pluginobject -- plugin media instance
    @param: KeyTag   -- exif key
    @param: KeyValue -- value to be saved
    """

    # LesserVersion would only be True when pyexiv2-to 0.1.3 is installed
    if LesserVersion:
        pluginobject[KeyTag] = KeyValue 
    else:
        # Exif KeyValue family?
        if "Exif" in KeyTag:
            try:
                pluginobject[KeyTag].value = KeyValue

            except KeyError:
                pluginobject[KeyTag] = pyexiv2.ExifTag(KeyTag, KeyValue)

            except (ValueError, AttributeError):
                pass

        # Iptc KeyValue family?
        elif "Iptc" in KeyTag:
            try:
                pluginobject[KeyTag].values = KeyValue

            except KeyError:
                pluginobject[KeyTag] = pyexiv2.IptcTag(KeyTag, KeyValue)

            except (ValueError, AttributeError):
                pass

        # Xmp KeyValue family?