diff --recursive --unified mirage-1.0_pre2.orig/mirage.py mirage-1.0_pre2/mirage.py --- mirage-1.0_pre2/mirage.py.orig 2012-12-10 13:28:48.000000000 +0200 +++ mirage-1.0_pre2/mirage.py 2019-08-24 15:01:22.110133416 +0300 @@ -64,11 +64,11 @@ print _("xmouse.so module not found, some screenshot capabilities will be disabled.") try: - import pyexiv2 + import exif HAS_EXIF = True except: HAS_EXIF = False - print _("pyexiv2 module not found, exifdata reading/writing are disabled") + print _("exif.so module not found, exifdata reading/writing are disabled") try: import gconf @@ -2337,9 +2337,8 @@ hbox.pack_start(vbox_right, False, False, 3) includes_exif = False if HAS_EXIF: - exifd = pyexiv2.ImageMetadata(self.currimg.name) - exifd.read() - if ([x for x in exifd.exif_keys if "Exif.Photo" in x]): + metadata = self.currimg.exif_metadata + if metadata is not None: includes_exif = True # The exif data exif_lbox = gtk.VBox() @@ -2349,13 +2348,13 @@ exif_vbox = gtk.VBox() exif_empty = gtk.Label(" ") - expo_l, expo_v = self.exif_return_label(exifd, _("Exposure time:"), _("%s sec"),"Exif.Photo.ExposureTime", "rat_frac") - aperture_l, aperture_v = self.exif_return_label(exifd, _("Aperture:"), _("%s"),"Exif.Photo.FNumber", "rat_float") - focal_l, focal_v = self.exif_return_label(exifd, _("Focal length:"), _("%s mm"),"Exif.Photo.FocalLength", "rat_int") - date_l, date_v = self.exif_return_label(exifd, _("Time taken:"), _("%s"),"Exif.Photo.DateTimeOriginal", "str") - ISO_l, ISO_v = self.exif_return_label(exifd, _("ISO Speed:"), _("%s"),"Exif.Photo.ISOSpeedRatings", "int") - bias_l, bias_v = self.exif_return_label(exifd, _("Exposure bias:"), _("%s"),"Exif.Photo.ExposureBiasValue", "rat_frac") - model_l, model_v = self.exif_return_label(exifd, _("Camera:"), _("%s"),"Exif.Image.Model", "str") + expo_l, expo_v = self.exif_return_label(metadata, _("Exposure time:"), _("%s sec"),'EXIF',"ExposureTime", "rat_frac") + aperture_l, aperture_v = self.exif_return_label(metadata, _("Aperture:"), _("%s"),'EXIF',"FNumber", "rat_float") + focal_l, focal_v = self.exif_return_label(metadata, _("Focal length:"), _("%s mm"),'EXIF',"FocalLength", "rat_int") + date_l, date_v = self.exif_return_label(metadata, _("Time taken:"), _("%s"),'EXIF',"DateTimeOriginal", "str") + ISO_l, ISO_v = self.exif_return_label(metadata, _("ISO Speed:"), _("%s"),'EXIF',"ISOSpeedRatings", "int") + bias_l, bias_v = self.exif_return_label(metadata, _("Exposure bias:"), _("%s"),'EXIF',"ExposureBiasValue", "rat_frac") + model_l, model_v = self.exif_return_label(metadata, _("Camera:"), _("%s"),'0',"Model", "str") exif_lbox.pack_start(exif_title, False, False, 2) exif_lbox.pack_start(aperture_l, False, False, 2) exif_lbox.pack_start(focal_l, False, False, 2) @@ -2390,19 +2389,19 @@ show_props.run() show_props.destroy() - def exif_return_label(self, exif, label_v, format, tag, type="str"): + def exif_return_label(self, metadata, label_v, format, ifd, tag, type="str"): label = gtk.Label(label_v) label.set_alignment(1, 1) - if tag in exif.exif_keys: - raw = exif[tag].value + if ifd in metadata and tag in metadata[ifd]: + raw = metadata[ifd][tag] if type == "rat_frac": - val = Fraction(str(raw)) + val = Fraction(raw[0][0], raw[0][1]) elif type == "rat_float": - val = float(raw) + val = float(raw[0][0]) / float(raw[0][1]) elif type == "rat_int": - val = int(raw) + val = int(round(float(raw[0][0]) / float(raw[0][1]))) elif type == "int": - val = int(raw) + val = int(raw[0]) else: val = raw value = gtk.Label(format % str(val)) @@ -4629,16 +4628,20 @@ self.height_original = self.height self.orientation = ImageData.ORIENT_NORMAL if HAS_EXIF : - exifd = pyexiv2.ImageMetadata(self.name) - exifd.read() - if "Exif.Image.Orientation" in exifd.exif_keys : - self.orientation = exifd["Exif.Image.Orientation"].value - if self.orientation == ImageData.ORIENT_LEFT : - self.rotate_pixbuf(90) - elif self.orientation == ImageData.ORIENT_MIRROR : - self.rotate_pixbuf(180) - elif self.orientation == ImageData.ORIENT_RIGHT : - self.rotate_pixbuf(270) + self.exif_metadata = exif.read_metadata(self.name) + if self.exif_metadata is not None: + try: + orientation = self.exif_metadata['1']['Orientation'][0] + except KeyError: + orientation = None + if orientation is not None : + self.orientation = orientation + if self.orientation == ImageData.ORIENT_LEFT : + self.rotate_pixbuf(90) + elif self.orientation == ImageData.ORIENT_MIRROR : + self.rotate_pixbuf(180) + elif self.orientation == ImageData.ORIENT_RIGHT : + self.rotate_pixbuf(270) self.zoomratio = 1 self.isloaded = True self.fileinfo = gtk.gdk.pixbuf_get_file_info(self.name)[0] diff --recursive --unified mirage-1.0_pre2.orig/po/cs.po mirage-1.0_pre2/po/cs.po --- mirage-1.0_pre2.orig/po/cs.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/cs.po 2019-08-22 15:18:10.630214010 +0300 @@ -31,7 +31,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/de.po mirage-1.0_pre2/po/de.po --- mirage-1.0_pre2.orig/po/de.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/de.po 2019-08-22 15:18:10.600214010 +0300 @@ -32,7 +32,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/es.po mirage-1.0_pre2/po/es.po --- mirage-1.0_pre2.orig/po/es.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/es.po 2019-08-22 15:18:10.640214010 +0300 @@ -32,7 +32,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/fr.po mirage-1.0_pre2/po/fr.po --- mirage-1.0_pre2.orig/po/fr.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/fr.po 2019-08-22 15:18:10.630214010 +0300 @@ -34,7 +34,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/he.po mirage-1.0_pre2/po/he.po --- mirage-1.0_pre2.orig/po/he.po 2012-12-10 12:49:54.000000000 +0200 +++ mirage-1.0_pre2/po/he.po 2019-08-22 15:18:10.620214010 +0300 @@ -32,7 +32,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/hu.po mirage-1.0_pre2/po/hu.po --- mirage-1.0_pre2.orig/po/hu.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/hu.po 2019-08-22 15:18:10.610214010 +0300 @@ -36,7 +36,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/it.po mirage-1.0_pre2/po/it.po --- mirage-1.0_pre2.orig/po/it.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/it.po 2019-08-22 15:18:10.620214010 +0300 @@ -33,7 +33,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/messages.po mirage-1.0_pre2/po/messages.po --- mirage-1.0_pre2.orig/po/messages.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/messages.po 2019-08-22 15:18:10.630214010 +0300 @@ -32,7 +32,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/nl.po mirage-1.0_pre2/po/nl.po --- mirage-1.0_pre2.orig/po/nl.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/nl.po 2019-08-22 15:18:10.620214010 +0300 @@ -31,7 +31,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/pl.po mirage-1.0_pre2/po/pl.po --- mirage-1.0_pre2.orig/po/pl.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/pl.po 2019-08-22 15:18:10.640214010 +0300 @@ -36,7 +36,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/pt_BR.po mirage-1.0_pre2/po/pt_BR.po --- mirage-1.0_pre2.orig/po/pt_BR.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/pt_BR.po 2019-08-22 15:18:10.610214010 +0300 @@ -33,7 +33,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/ru.po mirage-1.0_pre2/po/ru.po --- mirage-1.0_pre2.orig/po/ru.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/ru.po 2019-08-22 15:18:10.630214010 +0300 @@ -31,7 +31,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/po/uk.po mirage-1.0_pre2/po/uk.po --- mirage-1.0_pre2.orig/po/uk.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/uk.po 2019-08-22 15:18:10.620214010 +0300 @@ -38,8 +38,8 @@ "буде відключено." #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" -msgstr "Модуль pyexiv2 не знайдено, читання/запис exifdata буде відключено." +msgid "exif.so module not found, exifdata reading/writing are disabled" +msgstr "Модуль exif.so не знайдено, читання/запис exifdata буде відключено." #: mirage.py:79 #, python-format diff --recursive --unified mirage-1.0_pre2.orig/po/zh_CN.po mirage-1.0_pre2/po/zh_CN.po --- mirage-1.0_pre2.orig/po/zh_CN.po 2012-12-10 12:43:02.000000000 +0200 +++ mirage-1.0_pre2/po/zh_CN.po 2019-08-22 15:18:10.610214010 +0300 @@ -34,7 +34,7 @@ msgstr "" #: mirage.py:71 -msgid "pyexiv2 module not found, exifdata reading/writing are disabled" +msgid "exif.so module not found, exifdata reading/writing are disabled" msgstr "" #: mirage.py:79 diff --recursive --unified mirage-1.0_pre2.orig/setup.py mirage-1.0_pre2/setup.py --- mirage-1.0_pre2.orig/setup.py 2012-12-10 13:28:31.000000000 +0200 +++ mirage-1.0_pre2/setup.py 2019-08-22 15:07:14.900205205 +0300 @@ -37,6 +37,7 @@ py_modules = ['mirage'], ext_modules = [Extension(name='imgfuncs', sources=['imgfuncs.c']), Extension(name='xmouse', sources=['xmouse.c'], libraries=['X11']), + Extension(name='exif', sources=['exif.c'], libraries=['exif']), Extension(name='mirage_numacomp', sources=['mirage_numacomp.c'])], scripts = ['mirage'], data_files=[('share/mirage', ['README', 'COPYING', 'CHANGELOG', 'TODO', 'TRANSLATORS', 'stock_shuffle.png', 'stock_leave-fullscreen.png', 'stock_fullscreen.png', 'mirage_blank.png']),