#steaminf.py is only the class for reading the steam.inf for getting appid and version from it. #check.py use the class from steaminf.py and get the information about the current version from the steamapi
chmod u+x *.py ./check.py /home/manzzo/csgo_public/csgo/csgo/steam.inf If you want to use this on your webspace, your webserver have to support python. I think a version in php is better for webspace. 2012/8/24 JKavšek <[email protected]>: > Hey, thanks for the script. It gives me an error: > >> root@ubuntu:/home/manzzo/csgo_public/csgo# python steaminf.py >> root@ubuntu:/home/manzzo/csgo_public/csgo# python check.py >> Traceback (most recent call last): >> File "check.py", line 7, in <module> >> >> server = steaminf(sys.argv[1]) >> IndexError: list index out of range > > > What's this about. I have very little clue of python. > > How could I embed this somehow to a website. So I could go to for example > www.myserver.com/checkcsgopublic ? > > Are these guides okay and will I be able to do it or are you prepared to do > a basic website in html or whatever? > http://www.ehow.com/how_10039640_embed-python-html.html > http://www.digi.com/wiki/developer/index.php/Python_inside_HTML > > > > 2012/8/24 Andre Müller <[email protected]> >> >> Oh, sorry. There are some wrong newlines in the script which come from >> copy&paste. >> >> I think pastebin is better for exchange codesnippets: >> >> http://pastebin.com/Ghpy7Eyc >> http://pastebin.com/uA0RNwCT >> >> 2012/8/24 Andre Müller <[email protected]>: >> > This Script is not ready (missing exceptions ...). Maybe you can use >> > some parts. >> > >> > steaminf.py: >> > >> > #!/usr/bin/python >> > import re >> > class steaminf: >> > def __init__(self, steamfile): >> > self.steamfile = open(steamfile) >> > self.steaminfo = self.steamfile.read() >> > self.steaminfo = self.steaminfo.replace('\r','') >> > self.steamfile.close() >> > def getVersion(self): >> > self.version = >> > re.findall(r'PatchVersion=(.+)',self.steaminfo) >> > return self.version[0] >> > def getProductName(self): >> > self.productname = >> > re.findall(r'ProductName=(.+)',self.steaminfo) >> > return self.productname[0] >> > def getAppId(self): >> > self.appid = re.findall(r'appID=(.+)',self.steaminfo) >> > return self.appid[0] >> > >> > ---------------- >> > >> > check.py: >> > >> > #!/usr/bin/python >> > import sys >> > import urllib >> > import json >> > from steaminf import steaminf >> > >> > server = steaminf(sys.argv[1]) >> > >> > produkt = server.getProductName() >> > appid = server.getAppId() >> > version = server.getVersion() >> > requrl = >> > 'http://api.steampowered.com/ISteamApps/UpToDateCheck/v0001/?appid=%s&version=%s&format=json' >> > % (appid,version) >> > >> > >> > print "Der installierte %s Server mit der AppID %s hat die Version >> > %s" % (produkt,appid,version) >> > >> > try: >> > response = urllib.urlopen(requrl) >> > except: >> > print('Sorry, ein Fehler ist beim Aufruf der URL aufgetreten :-(') >> > sys.exit() >> > response = json.load(response) >> > response = response['response']['up_to_date'] >> > >> > if response is True: >> > print('Der Server ist aktuell') >> > else: >> > print('Der Server ist nicht mehr aktuell') >> > >> > Examlpe use: >> > csgo@n017:~$ ./check.py servers/war1/csgo/steam.inf >> > Der installierte csgo Server mit der AppID 730 hat die Version 1.17.5.1 >> > Der Server ist aktuell >> > csgo@n017:~$ >> > >> > Later i'll implement the tool srcdscheck for fallback and write a >> > class to update all games with hldsupdatetool and steamcmd. >> > At the moment i'm not motivated :-( >> >> _______________________________________________ >> Csgo_servers mailing list >> [email protected] >> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/csgo_servers > > > > _______________________________________________ > Csgo_servers mailing list > [email protected] > https://list.valvesoftware.com/cgi-bin/mailman/listinfo/csgo_servers _______________________________________________ Csgo_servers mailing list [email protected] https://list.valvesoftware.com/cgi-bin/mailman/listinfo/csgo_servers
