[gphotoframe/f16] Handle exif file with zero denominator on geometry information

Mamoru Tasaka mtasaka at fedoraproject.org
Mon Aug 13 08:01:22 UTC 2012


commit c7d4939621932a73e46a11478d292dcc8e201005
Author: Mamoru Tasaka <tasaka1 at localhost.localdomain>
Date:   Mon Aug 13 16:55:59 2012 +0900

    Handle exif file with zero denominator on geometry information

 gphotoframe-2.0a2-parseexif-geom-zerovalue.patch |   30 ++++++++++++++++++++++
 gphotoframe.spec                                 |   14 ++++++++--
 2 files changed, 41 insertions(+), 3 deletions(-)
---
diff --git a/gphotoframe-2.0a2-parseexif-geom-zerovalue.patch b/gphotoframe-2.0a2-parseexif-geom-zerovalue.patch
new file mode 100644
index 0000000..df06dff
--- /dev/null
+++ b/gphotoframe-2.0a2-parseexif-geom-zerovalue.patch
@@ -0,0 +1,30 @@
+--- ./gphotoframe-2.0-a2/lib/plugins/base/parseexif.py.zero	2012-02-15 16:05:52.000000000 +0900
++++ ./gphotoframe-2.0-a2/lib/plugins/base/parseexif.py	2012-08-13 16:21:32.000000000 +0900
+@@ -61,6 +61,14 @@
+ 
+         return orientation
+ 
++    def realvalue_geo(self, fracs):
++        result = 0.
++        factor = 1.
++        for frac in fracs:
++            result += frac.num and frac.num / factor / frac.den or 0.
++            factor *= 60.
++        return result
++
+     def get_geo(self):
+         lat_array = self.tags.get('GPS GPSLatitude')
+         lon_array = self.tags.get('GPS GPSLongitude')
+@@ -70,8 +78,10 @@
+             lon = lon_array.values
+             lat = lat_array.values
+ 
+-            x = lon[0].num + lon[1].num/60 + lon[2].num/3600/lon[2].den
+-            y = lat[0].num + lat[1].num/60 + lat[2].num/3600/lat[2].den
++            #x = lon[0].num + lon[1].num/60. + lon[2].num/3600./lon[2].den
++            #y = lat[0].num + lat[1].num/60. + lat[2].num/3600./lat[2].den
++            x = self.realvalue_geo(lon)
++            y = self.realvalue_geo(lat)
+ 
+             lon_ref = -1 if str(self.tags.get('GPS GPSLongitudeRef')) == 'W' else 1
+             lat_ref = -1 if str(self.tags.get('GPS GPSLatitudeRef'))  == 'S' else 1
diff --git a/gphotoframe.spec b/gphotoframe.spec
index 214f9f9..98e4b63 100644
--- a/gphotoframe.spec
+++ b/gphotoframe.spec
@@ -11,7 +11,7 @@
 %global	mainver	1.5.1
 #%%undefine	minorver	
 
-%global	mainrel	1
+%global	mainrel	2
 
 %global	rpmminorver	%(echo "%minorver" | sed -e 's|^-||' | sed -e 's|\\\.||')
 %global	fedorarel	%{?minorver:0.}%{mainrel}%{?minorver:.%rpmminorver}
@@ -28,6 +28,9 @@ License:	GPLv3 and GPLv2+
 URL:		http://code.google.com/p/gphotoframe/
 Source0:	http://gphotoframe.googlecode.com/files/%{name}-%{mainver}%{?minorver}.tar.gz
 
+# Handle exif file with zero denominator on geometry information
+Patch2:	gphotoframe-2.0a2-parseexif-geom-zerovalue.patch
+
 BuildRequires:	GConf2
 BuildRequires:	desktop-file-utils
 BuildRequires:	gettext
@@ -78,6 +81,8 @@ for gnome-screensaver compatibility.
 %prep
 %setup -q -n %{name}-%{mainver}%{?minorver}
 
+%patch2 -p2 -b .zeroden
+
 # Remove unneeded shebangs
 grep -rl '^#![ \t]*%{_bindir}' lib/ | \
 	xargs sed -i -e '\@^#![ \t]*%{_bindir}@d'
@@ -165,12 +170,12 @@ exit 0
 %postun
 if [ $1 -eq 0 ] ; then
 	touch --no-create %{_datadir}/icons/hicolor >/dev/null
-	gtk-update-icon-cache %{_datadir}/icons/hicolor >/dev/null
+	gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null
 fi
 exit 0
 
 %postrrans
-gtk-update-icon-cache %{_datadir}/icons/hicolor >/dev/null
+gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null
 exit 0
 
 
@@ -205,6 +210,9 @@ exit 0
 %{_datadir}/applications/screensavers/%{name}-screensaver.desktop
 
 %changelog
+* Mon Aug 19 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 1.5.1-2
+- Handle exif file with zero denominator on geometry information
+
 * Mon Mar  5 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 1.5.1-1
 - 1.5.1
 


More information about the scm-commits mailing list