Пример #1
0
def download(addons, path, extr):
    info = workshopinfo(addons)
    for res in info:
        if not "title" in res:
            print("Addon does not exist!")
            return

        name = res['title']
        download = res['file_url']

        print("Downloading '%s' from the workshop" % name)

        lzmafile = os.path.join(path, "%s.gma.lzma" % res['publishedfileid'])
        outfile = os.path.join(path, "%s.gma" % res['publishedfileid'])

        urllib.request.urlretrieve(download, lzmafile,
            lambda x, y, z: sys.stdout.write("\r{0:.2f}%".format(x * y / z)))
        sys.stdout.write("\r100.00%\n")

        print("Downloaded '%s' from the workshop. Decompressing..." % name)
        with lzma.open(lzmafile) as lzmaF:
            with open(outfile, "wb") as gma:
                gma.write(lzmaF.read())

        os.remove(lzmafile)

        if not extr: return

        name = os.path.join(path, re.sub('[\\/:"*?<>|]+', '_', name))
        gmafile.extract(outfile, name)
Пример #2
0
def download(addons, extr):
    info = workshopinfo(addons)
    for res in info:
        if not "title" in res:
            print("Addon does not exist!")
            return

        name = res['title']
        download = res['file_url']

        print("Downloading '%s' from the workshop" % name)

        w = Wgety()
        lzmafile = "%s.gma.lzma" % res['publishedfileid']
        outfile = "%s.gma" % res['publishedfileid']
        w.execute(url=download, filename=lzmafile)

        print("Downloaded '%s' from the workshop. Decompressing..." % name)
        with lzma.open(lzmafile) as lzmaF:
            with open(outfile, "wb") as gma:
                gma.write(lzmaF.read())

        os.remove(lzmafile)

        if not extr: return

        name = re.sub('[\\/:"*?<>|]+', '_', name)
        gmafile.extract(outfile, name)
Пример #3
0
def download(addons, path, extr):
    info = workshopinfo(addons)
    for res in info:
        if not "title" in res:
            print("Addon does not exist!")
            return

        if not "file_url" in res or res['file_url'] == '':
            print("Steam did not provide a direct download URL!")
            return

        name = res['title']
        download = res['file_url']

        print("Downloading '%s' from the workshop" % name)

        lzmafile = os.path.join(path, "%s.gma.lzma" % res['publishedfileid'])
        outfile = os.path.join(path, "%s.gma" % res['publishedfileid'])

        urllib.request.urlretrieve(
            download, lzmafile, lambda x, y, z: sys.stdout.write(
                "\r{0:.2f}%".format(x * y / z * 100)))
        sys.stdout.write("\r100.00%\n")

        print("Downloaded '%s' from the workshop. Decompressing..." % name)
        with lzma.open(lzmafile) as lzmaF:
            with open(outfile, "wb") as gma:
                gma.write(lzmaF.read())

        os.remove(lzmafile)

        if not extr: return

        name = os.path.join(path, re.sub('[\\/:"*?<>|]+', '_', name))
        gmafile.extract(outfile, name)
Пример #4
0
def download(addons, extr):
    info = workshopinfo(addons)
    for res in info:
        if not "title" in res:
            print("Addon does not exist!")
            return

        name = res['title']
        download = res['file_url']

        print("Downloading '%s' from the workshop" % name)

        w = Wgety()
        lzmafile = "%s.gma.lzma" % res['publishedfileid']
        outfile = "%s.gma" % res['publishedfileid']
        w.execute(url = download, filename = lzmafile)

        print("Downloaded '%s' from the workshop. Decompressing..." % name)
        with lzma.open(lzmafile) as lzmaF:
            with open(outfile, "wb") as gma:
                gma.write(lzmaF.read())

        os.remove(lzmafile)

        if not extr: return

        name = re.sub('[\\/:"*?<>|]+', '_', name)
        gmafile.extract(outfile, name)
Пример #5
0
def extract(gma_files, directories):
    for file in gma_files:
        for output_dir in directories:
            gmafile.extract(file, output_dir)
Пример #6
0
def extract(gma_files, directories):
	for file in gma_files:
		for output_dir in directories:
			gmafile.extract(file, output_dir)