Skip to content

Commit

Permalink
files.py - Change linux update download method
Browse files Browse the repository at this point in the history
Uses updated getRemoteFile function to download update tar file. Will retry using alternative method (stream = False) if fail.

Set Beta version 7
  • Loading branch information
ThioJoe committed Dec 19, 2022
1 parent f6c5008 commit 58cc116
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions Scripts/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,9 @@ def check_for_update(currentVersion, updateReleaseChannel, silentCheck=False):
print(f"\n> Downloading version: {F.GREEN}{latestVersion}{S.R}")

url = f'https://codeload.github.com/ThioJoe/YT-Spammer-Purge/tar.gz/refs/tags/v{latestVersion}'
r = requests.get(url, stream=True)
if(r.status_code == 200):
with open(tarFileName, 'wb') as file:
for chunk in r.iter_content(chunk_size=1048576):
if chunk:
file.write(chunk)
else:
print("Downloading of new version failed!")
print(f"\n> {F.RED}Error: {S.R}GitHub returned a non 200 status code while trying to download newer version.\nStatus returned: {r.status_code}")

fileDownloadResult = getRemoteFile(url, tarFileName)
if fileDownloadResult == False:
input("Press Enter to Exit...")
sys.exit()

Expand Down Expand Up @@ -477,7 +471,7 @@ def fetch_file(streamFileSwitch):
response = requests.get(url, headers=headers, stream=True)
if response.status_code != 200:
if silent == False:
print("Error fetching remote file or resource: " + url)
print("Error fetching remote file or resource: " + url)
print("Response Code: " + str(response.status_code))
else:
return response
Expand Down
2 changes: 1 addition & 1 deletion YTSpammerPurge.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
### IMPORTANT: I OFFER NO WARRANTY OR GUARANTEE FOR THIS SCRIPT. USE AT YOUR OWN RISK.
### I tested it on my own and implemented some failsafes as best as I could,
### but there could always be some kind of bug. You should inspect the code yourself.
version = "2.17.0-Beta6"
version = "2.17.0-Beta7"
configVersion = 32
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
print("Importing Script Modules...")
Expand Down

0 comments on commit 58cc116

Please sign in to comment.