chiark / gitweb /
Publish a category list with the repo, for quicker access
authorCiaran Gultnieks <ciaran@ciarang.com>
Tue, 14 Feb 2012 20:39:10 +0000 (20:39 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Tue, 14 Feb 2012 20:39:10 +0000 (20:39 +0000)
update.py

index 4c07f5d22132bc197e6490b0d0d3f7f482db84b5..367d754435d6e3647c1deaeff458d0b89dee0144 100755 (executable)
--- a/update.py
+++ b/update.py
@@ -75,6 +75,12 @@ if (repo_url is None or repo_name is None or
 # Get all apps...
 apps = common.read_metadata(verbose=options.verbose)
 
+# Generate a list of categories...
+categories = []
+for app in apps:
+    if app['Category'] not in categories:
+        categories.append(app['Category'])
+
 # Gather information about all the apk files in the repo directory...
 apks = []
 for apkfile in glob.glob(os.path.join('repo','*.apk')):
@@ -465,10 +471,18 @@ if repo_keyalias != None:
     if options.verbose:
         print output
 
-#Copy the repo icon into the repo directory...
+# Copy the repo icon into the repo directory...
 iconfilename = os.path.join(icon_dir, os.path.basename(repo_icon))
 shutil.copyfile(repo_icon, iconfilename)
 
+# Write a category list in the repo to allow quick access...
+catdata = ''
+for cat in categories:
+    catdata += cat + '\n'
+f = open('repo/categories.txt', 'w')
+f.write(catdata)
+f.close()
+
 # Update known apks info...
 knownapks = common.KnownApks()
 for apk in apks: