changeset 8:b9eb24a6213a

text_x_arnica: moved method get_exif_info to function
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 09 Mar 2008 18:07:13 +0100
parents a067ae7020f6
children 6fb3b03afe2e
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Sun Mar 09 17:53:43 2008 +0100
+++ b/data/plugin/parser/text_x_arnica.py	Sun Mar 09 18:07:13 2008 +0100
@@ -84,7 +84,23 @@
     import Image
 except ImportError:
     Image = None
+    
+# ToDo may be move to wikiutil    
+def get_exif_info(file_name):
+    """ gets exif info from image file 
+    @param: image file name 
+    """
+    date = "--"
+    if wikiutil.isPicture(file_name):
+        id_file = open(file_name, 'rb')
+        tags = EXIF.process_file(id_file, 'DateTimeOriginal')
+        id_file.close()
+        if tags.has_key('EXIF DateTimeOriginal'):
+            date = str(tags['EXIF DateTimeOriginal'])
+            date = date.replace(':', '-', 2)
 
+    return date
+    
 class Parser:
     """ arnica parser """
     extensions = '*.jpg'
@@ -363,21 +379,6 @@
      }
 
         return text
-    
-    def get_exif_info(self, file_name):
-        """ gets exif info from image file 
-        @param: image file name 
-        """
-        id_file = open(file_name, 'rb')
-        tags = EXIF.process_file(id_file, 'DateTimeOriginal')
-        id_file.close()
-        if tags.has_key('EXIF DateTimeOriginal'):
-            date = str(tags['EXIF DateTimeOriginal'])
-            date = date.replace(':', '-', 2)
-        else:
-            date = '--'
-
-        return date
 
     def get_files(self, path, files, quotes):
         """ get files creates lists for thumbnails and webnails 
@@ -416,7 +417,7 @@
                         self.web.append(webnail)
                         self.thumb.append(thumbfile)
                         
-                        date = self.get_exif_info(att_file)
+                        date = get_exif_info(att_file)
                         self.exif_date.append(wikiutil.escape(date, quote=1))
 
     def to_wikitext(self, text):