Last active
July 7, 2020 21:55
-
-
Save Zer0xFF/d8e1533e72d462f717647d053adf0aad to your computer and use it in GitHub Desktop.
RPCS3 update script linux/windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import platform | |
api_url = '' | |
file_name = '' | |
if(platform.system() == 'Windows'): | |
from pyunpack import Archive | |
# pip install pyunpack | |
# pip install patool | |
api_url = 'https://api.github.com/repos/RPCS3/rpcs3-binaries-win/releases/latest' | |
file_name = 'update.7z' | |
else: | |
import os | |
api_url = 'https://api.github.com/repos/RPCS3/rpcs3-binaries-linux/releases/latest' | |
file_name = 'RPCS3.AppImage' | |
resp = requests.get(url=api_url) | |
data = resp.json() | |
update_url = data['assets'][0]['browser_download_url'] | |
print(update_url) | |
response = requests.get(update_url, allow_redirects=True) | |
if(response): | |
response.raise_for_status() | |
file_size = int(response.headers['Content-length']) | |
print("Downloading: {} - Size: {}".format(file_name, file_size)) | |
with open(file_name, 'wb') as f: | |
downloaded_size = 0 | |
chunk_size = 1024 * 1024 | |
for block in response.iter_content(chunk_size): | |
f.write(block) | |
downloaded_size += len(block) | |
print("Downloaded: {:5.2f}MB/{:5.2f}MB - {:6.2f}%".format(downloaded_size / 1024.0 / 1024.0, file_size/ 1024.0 / 1024.0, 100.0 * downloaded_size / file_size)) | |
if(platform.system() != 'Windows'): | |
os.chmod(file_name, 0o755) | |
if(platform.system() == 'Windows'): | |
Archive(file_name).extractall('.') | |
print("Update Complete") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment