execfile('config.py')
-# Parse command line...
-parser = OptionParser()
-parser.add_option("-v", "--verbose", action="store_true", default=False,
- help="Spew out even more information than normal")
-(options, args) = parser.parse_args()
-
-# Get all apps...
-apps = common.read_metadata(options.verbose)
-
-html_parser = HTMLParser.HTMLParser()
-
-for app in apps:
-
- print "Processing " + app['id']
+# Check for a new version by looking at the Google market.
+# Returns (None, "a message") if this didn't work, or (version, vercode) for
+# the details of the current version.
+def check_market(app):
+ time.sleep(5)
url = 'http://market.android.com/details?id=' + app['id']
page = urllib.urlopen(url).read()
vercode = m.group(1)
if not vercode:
- print "...couldn't find version code"
- elif not version:
- print "...couldn't find version"
+ return (None, "Couldn't find version code")
+ if not version:
+ return (None, "Couldn't find version")
+ return (version, vercode)
+
+
+
+
+# Parse command line...
+parser = OptionParser()
+parser.add_option("-v", "--verbose", action="store_true", default=False,
+ help="Spew out even more information than normal")
+(options, args) = parser.parse_args()
+
+# Get all apps...
+apps = common.read_metadata(options.verbose)
+
+html_parser = HTMLParser.HTMLParser()
+
+for app in apps:
+
+ print "Processing " + app['id'] + '...'
+
+ mode = app['Update Check Mode']
+ if mode == 'Market':
+ (version, vercode) = check_market(app)
+ elif mode == 'None':
+ version = None
+ vercode = 'Checking disabled'
+ else:
+ version = None
+ vercode = 'Invalid update check method'
+
+ if not version:
+ print "..." + vercode
elif vercode == app['Market Version Code'] and version == app['Market Version']:
print "...up to date"
else:
metafile = os.path.join('metadata', app['id'] + '.txt')
common.write_metadata(metafile, app)
- time.sleep(5)
-
print "Finished."