From 5f2961872285d6c8e97be8a1fd1a9f830a6135d8 Mon Sep 17 00:00:00 2001 From: Wes Garner Date: Tue, 7 Sep 2010 21:10:50 -0500 Subject: [PATCH] get-google-files: update script and allow to select between mdpi, mdpi-tiny, and hdpi Change-Id: Ic3d78bfff3918e7a2e618a092566aa772ddcd13e remove my debug thing Change-Id: I6939362d4694f3854c6a1e3895e1d637dd1295b6 --- get-google-files | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/get-google-files b/get-google-files index 3084987d..a8f02e1c 100755 --- a/get-google-files +++ b/get-google-files @@ -2,15 +2,16 @@ import sys, random, urllib2, zipfile, StringIO, os from optparse import OptionParser -FILENAME="gapps-passion-FRF91-signed.zip" -MIRRORS=["http://www.kanged.net/mirror/gapps/",] +FILENAME=["gapps-hdpi-20100817-signed.zip","gapps-mdpi-20100816-signed.zip","gapps-mdpi-tiny-20100816-signed.zip"] +VERSIONS=["hdpi","mdpi","mdpi-tiny"] +MIRRORS=["http://mirror.kanged.net/gapps/",] def device(): - print "usage: extract-google-files -m [method]" + print "usage: get-google-files -m [method] -v [version]" print "Note: Device method is currently not implemented, please use download" sys.exit(1) -def download(): +def download(version): try: os.makedirs("proprietary") except: @@ -19,8 +20,16 @@ def download(): i = random.randrange(0, len(MIRRORS)-1) else: i = 0 - url = MIRRORS[i] + FILENAME - print "Fetching from %s" % url + + try: + j = VERSIONS.index(version.lower()) + except ValueError: + print "GApps version not found, defaulting to HDPI" + j = 0 + + url = MIRRORS[i] + FILENAME[j] + + print "Fetching %s GApps from %s" % (version.upper(),url) data = urllib2.urlopen(url).read() zip = zipfile.ZipFile(StringIO.StringIO(data),'r') @@ -39,14 +48,15 @@ def download(): def main(): parser = OptionParser(usage="usage: %prog [options]") - parser.add_option("-m", "--method", dest='method', default="download", help="Extraction Method: device, download [default: device]") + parser.add_option("-m", "--method", dest='method', default="download", help="Extraction Method: download") + parser.add_option("-v", "--version", dest='version', default="hdpi", help="GApps Version: hdpi, mdpi, mdpi-tiny [default: hdpi]") (options, args) = parser.parse_args() if options.method == "device": return device() if options.method == "download": - return download() + return download(options.version) if __name__ == '__main__': main()