chiark / gitweb /
Maximum icon size is now defined in config.py
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 19 Aug 2013 09:36:26 +0000 (11:36 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 19 Aug 2013 09:36:26 +0000 (11:36 +0200)
config.sample.py
fdroidserver/update.py

index d1417362dd5a4f7029813bdff3cc161fa53cc40c..33a278a2f2436005a5b137a1847e0ece9460f470 100644 (file)
@@ -20,6 +20,10 @@ gradle = "gradle"
 # Android gradle plugin version
 gradle_plugin = "0.5.+"
 
+# Max height and width (in pixels) for the icons in the repo
+# This corresponds to 72x72 pixels, i.e. mdpi
+icon_max_size = 72
+
 repo_url = "https://f-droid.org/repo"
 repo_name = "F-Droid"
 repo_icon = "fdroid-icon.png"
index 8e43071e4d811b73432006305f3a6e87f74e1f51..a5a1b17f48efdf3cea3323a51b4faced5cb6b693 100644 (file)
@@ -216,16 +216,16 @@ def delete_disabled_builds(apps, apkcache, repodirs):
 
 def resize_icon(iconpath):
     im = Image.open(iconpath)
-    if any(length > 72 for length in im.size):
+    if any(length > max_icon_size for length in im.size):
         print iconpath, "is too large:", im.size
-        im.thumbnail((72, 72), Image.ANTIALIAS)
+        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
 
 def resize_all_icons(repodirs):
-    """Resize all icons to max size 72x72 pixels
+    """Resize all icons that exceed the max size
 
     :param apps: list of all applications, as per common.read_metadata
     :param repodirs: the repo directories to process
@@ -639,9 +639,10 @@ def archive_old_apks(apps, apks, repodir, archivedir, keepversions):
 def main():
 
     # Read configuration...
-    global update_stats, archive_older
+    global update_stats, archive_older, max_icon_size
     update_stats = False
     archive_older = 0
+    max_icon_size = 72
     execfile('config.py', globals())
 
     # Parse command line...