mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 06:52:39 +03:00
More update check wip
This commit is contained in:
parent
ece3bfdbe1
commit
b36eeadce3
2 changed files with 42 additions and 20 deletions
|
@ -31,20 +31,11 @@ import common
|
||||||
execfile('config.py')
|
execfile('config.py')
|
||||||
|
|
||||||
|
|
||||||
# Parse command line...
|
# Check for a new version by looking at the Google market.
|
||||||
parser = OptionParser()
|
# Returns (None, "a message") if this didn't work, or (version, vercode) for
|
||||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
# the details of the current version.
|
||||||
help="Spew out even more information than normal")
|
def check_market(app):
|
||||||
(options, args) = parser.parse_args()
|
time.sleep(5)
|
||||||
|
|
||||||
# Get all apps...
|
|
||||||
apps = common.read_metadata(options.verbose)
|
|
||||||
|
|
||||||
html_parser = HTMLParser.HTMLParser()
|
|
||||||
|
|
||||||
for app in apps:
|
|
||||||
|
|
||||||
print "Processing " + app['id']
|
|
||||||
url = 'http://market.android.com/details?id=' + app['id']
|
url = 'http://market.android.com/details?id=' + app['id']
|
||||||
page = urllib.urlopen(url).read()
|
page = urllib.urlopen(url).read()
|
||||||
|
|
||||||
|
@ -60,9 +51,41 @@ for app in apps:
|
||||||
vercode = m.group(1)
|
vercode = m.group(1)
|
||||||
|
|
||||||
if not vercode:
|
if not vercode:
|
||||||
print "...couldn't find version code"
|
return (None, "Couldn't find version code")
|
||||||
elif not version:
|
if not version:
|
||||||
print "...couldn't find 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']:
|
elif vercode == app['Market Version Code'] and version == app['Market Version']:
|
||||||
print "...up to date"
|
print "...up to date"
|
||||||
else:
|
else:
|
||||||
|
@ -72,7 +95,5 @@ for app in apps:
|
||||||
metafile = os.path.join('metadata', app['id'] + '.txt')
|
metafile = os.path.join('metadata', app['id'] + '.txt')
|
||||||
common.write_metadata(metafile, app)
|
common.write_metadata(metafile, app)
|
||||||
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
print "Finished."
|
print "Finished."
|
||||||
|
|
||||||
|
|
|
@ -473,6 +473,7 @@ def write_metadata(dest, app):
|
||||||
mf.write('\\\n'.join(build['origlines']) + '\n')
|
mf.write('\\\n'.join(build['origlines']) + '\n')
|
||||||
if len(app['builds']) > 0:
|
if len(app['builds']) > 0:
|
||||||
mf.write('\n')
|
mf.write('\n')
|
||||||
|
writefield('Update Check Mode')
|
||||||
if len(app['Market Version']) > 0:
|
if len(app['Market Version']) > 0:
|
||||||
writefield('Market Version')
|
writefield('Market Version')
|
||||||
writefield('Market Version Code')
|
writefield('Market Version Code')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue