mirror of
https://github.com/corpnewt/gibMacOS.git
synced 2024-11-10 09:49:42 +01:00
Fix gzipped results
Yes i sneaked size into here shh
This commit is contained in:
parent
64f98e0c63
commit
996d067a38
@ -1,4 +1,5 @@
|
||||
import sys, os, time, ssl
|
||||
import sys, os, time, ssl, gzip
|
||||
from io import BytesIO
|
||||
# Python-aware urllib stuff
|
||||
if sys.version_info >= (3, 0):
|
||||
from urllib.request import urlopen, Request
|
||||
@ -130,6 +131,10 @@ class Downloader:
|
||||
if not chunk:
|
||||
break
|
||||
chunk_so_far += chunk
|
||||
if response.headers.get('Content-Encoding') == "gzip":
|
||||
fileobj = BytesIO(chunk_so_far)
|
||||
file = gzip.GzipFile(fileobj=fileobj)
|
||||
return file.read()
|
||||
return chunk_so_far
|
||||
|
||||
def stream_to_file(self, url, file, progress = True, headers = None):
|
||||
|
@ -212,6 +212,10 @@ class gibMacOS:
|
||||
else:
|
||||
# Add them all!
|
||||
prodd["packages"] = plist_dict.get("Products",{}).get(prod,{}).get("Packages",[])
|
||||
# Get size
|
||||
prodd["size"] = 0
|
||||
for i in prodd["packages"]: prodd["size"] += i["Size"]
|
||||
prodd["size"] = self.d.get_size(prodd["size"])
|
||||
# Attempt to get the build/version info from the dist
|
||||
b,v,n = self.get_build_version(plist_dict.get("Products",{}).get(prod,{}).get("Distributions",{}))
|
||||
prodd["title"] = smd.get("localization",{}).get("English",{}).get("title",n)
|
||||
@ -404,7 +408,7 @@ class gibMacOS:
|
||||
var1 = "{}. {} {}".format(num, p["title"], p["version"])
|
||||
if p["build"].lower() != "unknown":
|
||||
var1 += " ({})".format(p["build"])
|
||||
var2 = " - {} - Added {}".format(p["product"], p["date"])
|
||||
var2 = " - {} - Added {} - {}".format(p["product"], p["date"], p["size"])
|
||||
if self.find_recovery and p["installer"]:
|
||||
# Show that it's a full installer
|
||||
var2 += " - FULL Install"
|
||||
|
Loading…
Reference in New Issue
Block a user