mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 22:40:12 +01:00
More update check wip
This commit is contained in:
parent
ece3bfdbe1
commit
b36eeadce3
@ -31,20 +31,11 @@ import common
|
||||
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()
|
||||
|
||||
@ -60,9 +51,41 @@ for app in apps:
|
||||
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:
|
||||
@ -72,7 +95,5 @@ for app in apps:
|
||||
metafile = os.path.join('metadata', app['id'] + '.txt')
|
||||
common.write_metadata(metafile, app)
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
print "Finished."
|
||||
|
||||
|
@ -473,10 +473,11 @@ def write_metadata(dest, app):
|
||||
mf.write('\\\n'.join(build['origlines']) + '\n')
|
||||
if len(app['builds']) > 0:
|
||||
mf.write('\n')
|
||||
writefield('Update Check Mode')
|
||||
if len(app['Market Version']) > 0:
|
||||
writefield('Market Version')
|
||||
writefield('Market Version Code')
|
||||
mf.write('\n')
|
||||
mf.write('\n')
|
||||
writecomments(None)
|
||||
mf.close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user