IncognitoMode Posted May 17, 2018 Sorry if this has been posted before, is there an auto updater for GZDOOM? it gets annoying having to reinstall it every time it gets an update like every week 0 Quote Share this post Link to post
<inactive>Player Lin Posted May 20, 2018 You don't needed "install" GZDooM at all, since all official downloads of GZDooM(even dev. builds) are zipped package. Just download the zip and extract anything in it to your hard disk(or overwrote your old version of GZDooM). Also, the idea of auto-updater already "NO-ed" in past. 0 Quote Share this post Link to post
Jerry.C Posted May 20, 2018 On 5/18/2018 at 1:14 AM, IncognitoMode said: ... every time it gets an update like every week You mean every month? The zdoom.org news page lists four releases this year: 3.2.5, 3.3.0, 3.3.1 and 3.3.2. 0 Quote Share this post Link to post
boris Posted May 20, 2018 3 hours ago, Jerry.C said: You mean every month? The zdoom.org news page lists four releases this year: 3.2.5, 3.3.0, 3.3.1 and 3.3.2. Obviously @IncognitoMode means the dev builds. I wrote a small Python script that reads the HTML of the site, downloads and unpacks the latest version of GZDoom. Requires the Python 3, and the HTMLParser and requests modules, and 7zip. from html.parser import HTMLParser import os.path import requests import subprocess platform = 'x64' # or x32 for the 32-bit version gzdoom_dir = 'c:/games/doom/ports/gzdoom/' download_dir = gzdoom_dir sevenzip_exe = 'c:/Program Files/7-Zip/7z.exe' class DevBuildsParser(HTMLParser): def download_file(self, url, out_file): print('Downloading', url, 'to', out_file) r = requests.get(url, stream=True) if r.status_code != 200: return False, r.status_code with open(out_file, 'wb') as file: for chunk in r: file.write(chunk) return True, 0 def handle_starttag(self, tag, attrs): # There's no nice way to stop the HTMLParser, so just don't do anything # for the rest of the HTML when we're already finished if self.finished: return # A td tag with the class x-filename is the introduction to the URL, # followed by an a tag that includes the path to the file if tag == 'td' and len([ True for x in attrs if x[0] == 'class' and x[1] == 'x-filename' ]) == 1: self.found_filename = True elif tag == 'a' and self.found_filename: file_path = [ x[1] for x in attrs if x[0] == 'href' ][0] if platform in file_path: self.finished = True out_file = download_dir + file_path.split('/')[-1] url = 'https://devbuilds.drdteam.org' + file_path # Check if we previously downloaded the latest version, and # stop processing if so if os.path.isfile('updater.version'): with open('updater.version', 'r') as file: version = file.read().strip() if version == file_path.split('/')[-1]: print('Already got the latest version, no need to do anything') input('\nPress enter to exit') return success, error_code = self.download_file(url, out_file) if not success: print('Error downloading file. HTTP error code:', error_code) input('\nPress enter to exit') return print('Unpacking...') try: subprocess.check_output([sevenzip_exe, 'x', out_file, '-aoa', '-o' + gzdoom_dir], stderr=subprocess.STDOUT) print('Removing', out_file) os.remove(out_file) # Write version file print('Updating version file') with open('updater.version', 'w') as file: file.write(file_path.split('/')[-1]) print('Update finished') input('\nPress enter to exit') except subprocess.CalledProcessError as e: print('Error unpacking:') print('Return code:', e.returncode) print('Output:', output.decode('utf-8')) else: # Sanity check. Make sure that a td with class=x-filename has to # come before the a tag, so that we don't download who-knows-what # when the HTML changes self.found_filename = False def __init__(self): HTMLParser.__init__(self) self.found_filename = False self.finished = False r = requests.get('https://devbuilds.drdteam.org/gzdoom/') if r.status_code != 200: print('HTTP error:', r.status_code) exit(1) parser = DevBuildsParser() parser.feed(r.text) Script is also attached. Note that it does some big assumptions about the HTML layout and file names, so it might break in the future. Make sure to change the paths at the top to your environment. updater.7z 1 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.