]> Frank Brehm's Git Trees - my-stuff/python.git/commitdiff
Added evaluation of metadata
authorFrank Brehm <frank@brehm-online.com>
Sun, 25 May 2014 11:15:26 +0000 (13:15 +0200)
committerFrank Brehm <frank@brehm-online.com>
Sun, 25 May 2014 11:15:26 +0000 (13:15 +0200)
DE-env.py

index 012c91cf9e8a786e41d968a97a8716d33fbcc868..1d22498ed45dd796c8f5023eafa782372b0d58bb 100755 (executable)
--- a/DE-env.py
+++ b/DE-env.py
@@ -18,6 +18,7 @@ import random
 from gi.repository import Gio
 from gi.repository import Gdk
 import logging
+import pprint
 
 from wand.image import Image
 from wand.color import Color
@@ -82,6 +83,18 @@ def init_logging():
 
 init_logging()
 
+#-------------------------------------------------------------------------
+def pp(value):
+    """
+    Returns a pretty print string of the given value.
+
+    @return: pretty print string
+    @rtype: str
+    """
+
+    pretty_printer = pprint.PrettyPrinter(indent = 4)
+    return pretty_printer.pformat(value)
+
 #-------------------------------------------------------------------------
 def get_desktop_environment():
     #From http://stackoverflow.com/questions/2035657/what-is-my-current-desktop-environment
@@ -375,6 +388,11 @@ new_img_fname = '/tmp/wallpaper.jpg'
 old_img = Image(filename = wpaper)
 new_img = old_img.clone()
 
+exif = {}
+for k, v in old_img.metadata.items():
+    exif[k] = v
+log.debug("Found Metadata:\n%s", pp(exif))
+
 (screen_width, screen_height) = get_max_monitor_geometry()
 new_height = screen_height
 new_width = int(float(old_img.width) / float(old_img.height) * float(screen_height))