view MoinMoin/filter/image_jpeg.py @ 6133:a6283e189869 tip

fixup: remove nonexisting passlib.utils._blowfish this was removed by the passlib 1.7.1 upgrade.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 01 Jun 2017 18:10:19 +0200
parents 6275f8695bc8
children
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - image/jpeg Filter

    @copyright: 2006 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
"""
from MoinMoin.filter import EXIF

def execute(indexobj, filename):
    """ Extract some EXIF data """
    try:
        f = file(filename, 'rb')
        tags = EXIF.process_file(f)
        f.close()
        # get rid of some big stuff:
        try:
            del tags["JPEGThumbnail"]
        except:
            pass
        try:
            del tags["EXIF MakerNote"]
        except:
            pass
        data = str(tags).decode('utf-8')
    except (ValueError, TypeError, KeyError): # EXIF throws ValueError on unknown tags
                                              # TypeError on other occassions
                                              # KeyError too
        data = u''
    return data