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

Reply via email to