From: Ciaran Gultnieks Date: Wed, 21 Aug 2013 20:47:48 +0000 (+0100) Subject: Icon resizing diagnostics/robustness X-Git-Tag: 0.1~437 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=eec320a08db845d49dc38f0db9a24964938f6428;p=fdroidserver.git Icon resizing diagnostics/robustness --- diff --git a/fdroidserver/update.py b/fdroidserver/update.py index a5a1b17f..a59f2848 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -215,14 +215,18 @@ def delete_disabled_builds(apps, apkcache, repodirs): del apkcache[apkfilename] def resize_icon(iconpath): - im = Image.open(iconpath) - if any(length > max_icon_size for length in im.size): - print iconpath, "is too large:", im.size - im.thumbnail((max_icon_size, max_icon_size), Image.ANTIALIAS) - print iconpath, "new size:", im.size - im.save(iconpath, "PNG") - else: - print iconpath, "is small enough:", im.size + try: + im = Image.open(iconpath) + if any(length > max_icon_size for length in im.size): + print iconpath, "is too large:", im.size + im.thumbnail((max_icon_size, max_icon_size), Image.ANTIALIAS) + print iconpath, "new size:", im.size + im.save(iconpath, "PNG") + else: + if options.verbose: + print iconpath, "is small enough:", im.size + except Exception,e: + print "ERROR: Failed processing {0} - {1}".format(iconpath, e) def resize_all_icons(repodirs): """Resize all icons that exceed the max size