[googlecl/el6] Add patch to detect the content_type of photos using the mimetypes library

Niels de Vos devos at fedoraproject.org
Sat Apr 7 15:49:00 UTC 2012


commit f04a4a9ba798140ba9e749f4fb81111ae434a408
Author: Niels de Vos <devos at fedoraproject.org>
Date:   Sat Apr 7 17:48:10 2012 +0200

    Add patch to detect the content_type of photos using the mimetypes library
    
    Resolves #810641

 googlecl-0.9.9_picase-mimetypes.patch |   29 +++++++++++++++++++++++++++++
 googlecl.spec                         |    7 ++++++-
 2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/googlecl-0.9.9_picase-mimetypes.patch b/googlecl-0.9.9_picase-mimetypes.patch
new file mode 100644
index 0000000..f0e61d3
--- /dev/null
+++ b/googlecl-0.9.9_picase-mimetypes.patch
@@ -0,0 +1,29 @@
+--- googlecl-0.9.9/src/googlecl/picasa/service.py	2010-07-24 04:01:12.000000000 +0200
++++ googlecl-0.9.9.mimetypes/src/googlecl/picasa/service.py	2012-04-07 17:27:21.748454098 +0200
+@@ -22,6 +22,7 @@
+ import logging
+ import os
+ import urllib
++import mimetypes
+ import googlecl
+ import googlecl.service
+ from googlecl.picasa import SECTION_HEADER
+@@ -255,15 +256,9 @@
+       if not tags and self.prompt_for_tags:
+         keywords = raw_input('Enter tags for photo %s: ' % path)
+       LOG.info('Loading file ' + path + ' to album ' + album.title.text)
+-      ext = googlecl.get_extension_from_path(path)
+-      if not ext:
+-        LOG.debug('No extension match on path ' + path)
+-        content_type = 'image/jpeg'
+-      else:
+-        try:
+-          content_type = SUPPORTED_VIDEO_TYPES[ext]
+-        except KeyError:
+-          content_type = 'image/' + ext
++      if not mimetypes.inited:
++        mimetypes.init()
++      content_type = mimetypes.guess_type(path)[0]
+       try:
+         self.InsertPhotoSimple(album_url, 
+                                title=os.path.split(path)[1], 
diff --git a/googlecl.spec b/googlecl.spec
index a8fbaac..48c57ed 100644
--- a/googlecl.spec
+++ b/googlecl.spec
@@ -5,13 +5,14 @@
 
 Name:		googlecl
 Version:	0.9.9
-Release:	2%{?dist}
+Release:	3%{?dist}
 Summary:	Command line tools for the Google Data APIs
 
 Group:		Applications/Internet
 License:	ASL 2.0
 URL:		http://code.google.com/p/googlecl/
 Source0:	http://googlecl.googlecode.com/files/%{name}-%{version}.tar.gz
+Patch0:		googlecl-0.9.9_picase-mimetypes.patch
 
 BuildArch:	noarch
 BuildRequires:	python-setuptools
@@ -26,6 +27,7 @@ their GData APIs.
 
 %prep
 %setup -q
+%patch0 -p1 -b.picasa_mimetypes
 
 
 %build
@@ -51,6 +53,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Sat Apr  7 2012 Niels de Vos <devos at fedoraproject.org> - 0.9.9-3
+- Detect the content_type of photos using the mimetypes library (#810641)
+
 * Fri Jul 30 2010 Adam Goode <adam at spicenitz.org> - 0.9.9-2
 - Add python-setuptools to BuildRequires
 


More information about the scm-commits mailing list