From 82ecd3886fcb6451e4a95ee35ab8775f6d41c669 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Sun, 25 May 2014 13:21:47 +0200 Subject: [PATCH] Minor changes --- DE-env.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/DE-env.py b/DE-env.py index 1d22498..4a87564 100755 --- a/DE-env.py +++ b/DE-env.py @@ -383,15 +383,28 @@ if os.path.exists(wpaper) and os.path.isfile(wpaper): title = os.path.basename(wpaper) title = re.sub(r'\.[^\.]*$', '', title) title = re.sub(r'_+', ' ', title) +log.debug("New title from filename: %r", title) new_img_fname = '/tmp/wallpaper.jpg' old_img = Image(filename = wpaper) new_img = old_img.clone() exif = {} +comment = None +re_comment = re.compile(r'^comment\s*$', re.IGNORECASE) for k, v in old_img.metadata.items(): exif[k] = v + if re_comment.search(k): + comment = v log.debug("Found Metadata:\n%s", pp(exif)) +if comment: + log.debug("Found comment: %r", comment) + for line in comment.splitlines(): + line = line.strip() + if line: + title = line + log.debug("New title from comment: %r", title) + break (screen_width, screen_height) = get_max_monitor_geometry() new_height = screen_height -- 2.39.5