def __init__(self, software, dest_path=__BASE_FOLDER__): super().__init__( target=software, dest_path=dest_path, target_enum=DownloadTarget.SOFTWARE, Extractor=EXTRACTORS[get_os()], delete_files=_delete_software )
def __init__(self, updater, dest_path=__BASE_FOLDER__): super().__init__( target=updater, dest_path=dest_path, target_enum=DownloadTarget.UPDATER, Extractor=EXTRACTORS[get_os()], delete_files=_delete_updater )
def _download_versions_file(): """Download the json file containing all the information about the latest version of the software. Return a dictionary containing only the information for the running OS. Return a dictionary from a json with the following structure: { "windows": { "software": { "version": "...", "url": "...", "hash_code": "...", "size": ... }, "updater": { "version": "...", "url": "...", "hash_code": "...", "size": ... } }, "linux": { "software": { "version": "...", "url": "...", "hash_code": "...", "size": ... }, "updater": { "version": "...", "url": "...", "hash_code": "...", "size": ... } }, "mac": { "software": { "version": "...", "url": "...", "hash_code": "...", "size": ... }, "updater": { "version": "...", "url": "...", "hash_code": "...", "size": ... } } "raspberry": { "software": { "version": "...", "url": "...", "hash_code": "...", "size": ... }, "updater": { "version": "...", "url": "...", "hash_code": "...", "size": ... } } } """ try: version_dict = json.load(BytesIO(download_file( Constants.VERSION_LINK)))[get_os()] except Exception: return None else: return version_dict