All pastes #784741 Raw Edit

Mine

public python v1 · immutable
·published 2007-11-19 20:40 UTC
rendered paste body
version = "0.91a-rc1"__module_name__ = "Systeminformation"__module_version__ = version__module_description__ = "Python module for XChat2"# by jointhehell# thx to mots and asciiimport xchatimport commandsimport stringimport platformdef systeminfo(word, word_eol, userdata):    ##### Do not modify anything below this line ####    ## Output is at the bottom - that's what you can modify ##    #################################################        ##System    distname,codename,id = platform.dist()    architecture,linkage = platform.architecture()    ostype,hostname,kernel,compiletime,machine,processor = platform.uname()    ###    #Uptime    minutes,seconds=divmod(float(commands.getoutput("cat /proc/uptime | awk '{print $1}'")), 60)    if minutes >= 60:         hours,minutes=divmod(minutes, 60)        uptime = "Uptime: "+str(int(hours))+"h "+str(int(minutes))+"min "+str(seconds)+"s"    else:        uptime = "Uptime: "+str(int(minutes))+"min "+str(seconds)+"s"     ###    #CPU    cpuname = "Cpu Name: "+commands.getoutput("cat /proc/cpuinfo | grep \"model name\"")[13:]    cpucache = "Cpu Cache: "+commands.getoutput("cat /proc/cpuinfo | grep \"cache size\"")[13:]    cpubogomips = "Cpu Bogomips: "+commands.getoutput("cat /proc/cpuinfo | grep \"bogomips\" | awk '{print $3}'")    cpufreqraw = float(commands.getoutput("cat /proc/cpuinfo | grep \"cpu MHz\"")[11:])    if cpufreqraw >= 1000.0:        cpufreq = "Cpu Freq.: "+str(cpufreqraw/1000.0)+"ghz"    else:        cpufreq = "Cpu Freq.: "+str(cpufreqraw)+"mhz"    ###    #X infos    xversion = "Xorg Version: "+commands.getoutput("xdpyinfo | grep \"X.Org version\"")[15:]    xresolution = "Resolution: "+commands.getoutput("xdpyinfo | grep dimensions | awk '{print $2}'")    xscreens = "Screens: "+commands.getoutput("xdpyinfo | grep \"number of screens\" | awk '{print $4}'")    ###    #Ram infos    ramtotal = "Total RAM: "+str(int(commands.getoutput("cat /proc/meminfo | grep \"MemTotal\" | awk '{print $2}'"))/1024)+"MB"    ramfree = "Free RAM: "+str(int(commands.getoutput("cat /proc/meminfo | grep \"MemFree\" | awk '{print $2}'"))/1024)+"MB"    ###    #Graphics    openglrenderraw = commands.getoutput("glxinfo | grep \"OpenGL renderer string\"")[24:]    openglrender = openglrenderraw.split('/')[0]    openglvendor = commands.getoutput("glxinfo | grep \"OpenGL vendor string\" | sed 's/\/*//g'")[22:]    driverver = "Driver version: "+commands.getoutput("glxinfo | grep \"OpenGL version string\"")[23:]    ###    #Sound    soundcard = commands.getoutput("lspci | grep \"Multimedia audio controller\"")[37:]    ###    ##########################        #### Output: ###        if len(word) <= 1:        xchat.command("say SystemInfo for "+hostname)        xchat.command("say ==System=========")        xchat.command("say Distribution: "+distname+" "+codename+" "+architecture)        xchat.command("say Kernel: "+ostype+" "+kernel+" "+machine)        xchat.command("say "+uptime)        xchat.command("say ==CPU============")        xchat.command("say "+cpuname)        xchat.command("say "+cpufreq)        xchat.command("say "+cpucache)        xchat.command("say "+cpubogomips)        xchat.command("say ==RAM============")        xchat.command("say "+ramtotal)        xchat.command("say "+ramfree)        xchat.command("say ==Graphics=======")        xchat.command("say Card: "+openglvendor+" "+openglrender)        xchat.command("say "+driverver)        xchat.command("say ==Sound==========")        xchat.command("say Card: "+soundcard)        xchat.command("say ==Xorg===========")        xchat.command("say "+xversion)        xchat.command("say "+xresolution)        xchat.command("say "+xscreens)        xchat.command("say =================")    if len(word) > 1:        if word[1] == 'system':            xchat.command("say ==System=========")            xchat.command("say Hostname: "+hostname)            xchat.command("say Distribution: "+distname+" "+codename+" "+architecture)            xchat.command("say Kernel: "+ostype+" "+kernel+" "+machine)            xchat.command("say "+uptime)            xchat.command("say ================")        elif word[1] == 'cpu':            xchat.command("say ==CPU============")            xchat.command("say "+cpuname)            xchat.command("say "+cpufreq)            xchat.command("say "+cpucache)            xchat.command("say "+cpubogomips)            xchat.command("say ================")        elif word[1] == 'ram':            xchat.command("say ==RAM============")            xchat.command("say "+ramtotal)            xchat.command("say "+ramfree)            xchat.command("say ================")        elif word[1] == 'gfx':            xchat.command("say ==Graphics======")            xchat.command("say Card: "+openglvendor+" "+openglrender)            xchat.command("say "+driverver)            xchat.command("say ================")         elif word[1] == 'sound':            xchat.command("say ==Sound==========")            xchat.command("say Card: "+soundcard)            xchat.command("say ================")        elif word[1] == 'xorg':            xchat.command("say ==Xorg===========")            xchat.command("say "+xversion)            xchat.command("say "+xresolution)            xchat.command("say "+xscreens)            xchat.command("say ================")        elif word[1] == 'compact':            xchat.command("say ["+hostname+"] ["+distname+" "+codename+" "+architecture+"] [Kernel: "+ostype+" "+kernel+" "+machine+"] ["+uptime+"] ["+cpuname+"] ["+ramtotal+"] ["+openglvendor+" "+openglrender+"]")        elif word[1] == 'local':            print "SystemInfo for "+hostname            print "==System========="            print "Distribution: "+distname+" "+codename+" "+architecture            print "Kernel: "+ostype+" "+kernel+" "+machine            print uptime            print "==CPU============"            print cpuname            print cpufreq            print cpucache            print cpubogomips            print "==RAM============"            print ramtotal            print ramfree            print "==Graphics======="            print "Card: "+openglvendor+" "+openglrender            print driverver            print "==Sound=========="            print "Card: "+soundcard            print "==Xorg==========="            print xversion            print xresolution            print xscreens            print "================="        else:            print "Invalid Option. Use /help systeminfo for a list."    return xchat.EAT_ALLxchat.hook_command("systeminfo", systeminfo, help="Spams systeminformations\nYou can spam specific infos by using /systeminfo <option>\nOptions:\n system\n cpu\n ram\n gfx\n xorg\n compact (Prints only important stuff)\n local (shows it only to you)")print 'Systeminformation '+version+' by JoinTheHell loaded'print 'Command: /systeminfo | Help: /help systeminfo'