import xchat,os,copy,time # About this plugin __module_name__ = "aVirtualInferno" __module_version__ = "6.3.4 (Tubercle)" __module_description__ = "Mac system info and media output" # # This script was created by inferno10 @ TWiT IRC, and is based on # M[OSX]S. It was written in TCL for 10.4 - 10.8 compatibility, then converted to # Python for OSx86 compatibility. # # Feel free to modify this code, but please give credit to the authors! # # Compatibility note: The /macinfo command is compatible with 10.4 and above # # Weather information courtesy Weather Underground # # is.gd URL shortening code provided by Hipp @ TWiT IRC. # # Usage: /macinfo displays your system information # Arguments (do not include quotes) # 'silent' will print the resulting output just locally # '#' will output the info in the MIRC color of your choice # 'nocolor' will strip any color and formatting from output # 'full' will output the info from the flags below # 'cpu' will include the CPU count and CPU type # 'speed' will include the CPU(s) speed # 'temp' will include the CPU and GPU temp (if possible) # 'bat' will include the battery information (if applicable) # 'ram' will include the RAM usage information # 'hd' will include storage capacity information # 'res' will include the display resolution for all displays # 'os' will include operating system version information # 'process' will include the running process count # 'uptime' will include the system uptime # /mactunes will display iTunes (default) or RealPlayer info # Arguments (do not include quotes) # 'silent' will print the resulting output just locally # '#' will output the info in the MIRC color of your choice # 'nocolor' will strip any color and formatting from output # 'real' will output RealPlayer information instead # 'full' will output the info from the flags below # 'bitrate' will include the bit rate info # 'count' will include the number of times song was played # 'rating' will include the star-rating for the song # 'time' will include the time elapsed in the song # 'length' will include just the length of the song # 'year' will include the year of the current item # 'url' will include the URL if listening to a stream # /macmovie will display the foremost movie info from QuickTime # Arguments (do not include quotes) # 'silent' will print the resulting output just locally # '#' will output the info in the color of your choice # 'nocolor' will strip any color and formatting from output # 'full' will output the info from the flags below # 'resolution' will include the resolution of the movie # 'time' will include the time elapsed in the movie # /macweather display weather for a city # Arguments (do not include quotes) # 'silent' will print the resulting output just locally # 'nocolor' will strip any color and formatting from output # 'full' will output the info from the flags below # 'humidity' will include the humidity information # 'pressure' will include atmospheric pressure information # 'wind' will include windspeed and direction information # /macage will display your age in years # must be specified in one of three formats: # MM/DD/YYYY # DD/MM/YYYY # YYYY/MM/DD # # /mis shorten url using is.gd # # /mtu shorten url using TinyURL # # Global Variables xchatdir = xchat.get_info("xchatdir") includeColor = 0 # DO NOT EDIT THESE VARIABLES modehook = None creationhook = None chanlist = [""] chancolor = [0] previousBoard = "" def getinfo (args): global includeColor showDefault = 0 goFull = 0 includeOS = 0 includeCPU = 0 includeCPUSpeed = 0 includeTemp = 0 # Set to 1 if you wish to include the CPU temperature includeMemory = 0 includeCache = 0 includeHD = 0 # Set to 1 to always include hard drive information includeProcessCount = 0 includeUptime = 0 includeGraphics = 0 includeBattery = 0 silentMode = 0 includeGraphicsCard = 0 isCharged = "No" isCharging = "No" goBat = "No" cpucount = 0 isIntel = 0 output = "" dataTypes = "SPHardwareDataType" noColor = 0 coloredText = "" designCapacity="" arglength = len(args) if arglength > 1: i = 1 while i < arglength: temp = args[i] if temp == "os" or temp == "full": includeOS = 1 if temp == "hd" or temp == "full": includeHD = 1 if temp == "cpu" or temp == "full": includeCPU = 1 if temp == "speed" or temp == "full": includeCPUSpeed = 1 if temp == "temp" or temp == "full": includeTemp = 1 if temp == "ram" or temp == "full": includeMemory = 1 if temp == "process" or temp == "full": includeProcessCount = 1 if temp == "uptime" or temp == "full": includeUptime = 1 if temp == "gfx" or temp == "full": includeGraphics = 1 if temp == "bat" or temp == "full": includeBattery = 1 if temp == "cache" or temp == "full": includeCache = 1 if temp == "nocolor": noColor = 1 if temp == "silent": silentMode = 1 i = i + 1 if includeOS == 0: if includeHD == 0: if includeCPU == 0: if includeCPUSpeed == 0: if includeTemp == 0: if includeMemory == 0: if includeProcessCount == 0: if includeUptime == 0: if includeGraphics == 0: if includeBattery == 0: if includeCache == 0: showDefault = 1 else: showDefault = 1 if showDefault == 1: includeOS = 1 includeCPU = 1 includeCPUSpeed = 1 includeMemory = 1 includeHD = 1 includeUptime = 1 temp = os.popen('sysctl hw.model') temp = temp.readline() compmodel = stripit(temp) temp = refMachineType(compmodel) if len(temp) < 1: temp = os.popen('sw_vers') lines = temp.readlines() for line in lines: if line.find("ProductVersion") != -1: temp = line.split(':') osxVersion = trim(temp[1]) if osxVersion.find("10.6") != -1: cmd = "cat /System/Library/CoreServices/Resources/SPMachineTypes.plist | grep -A 1 \"" + compmodel + "\"" else: cmd = "cat /System/Library/SystemProfiler/SPPlatformReporter.spreporter/Contents/Resources/SPMachineTypes.plist | grep -A 1 \"" + compmodel + "\"" temp = os.popen(cmd) junkline = temp.readline() temp = temp.readline() if len(temp) > 0: temp = temp.split('>') temp = temp[1] temp = temp.split('<') temp = temp[0] machine = refModel(temp) else: machine = refGenericModel(compmodel) else: machine = refModel(temp) if noColor == 0: coloredText = "" temp = machine.lower() if temp.startswith('a'): vowelText = "n" elif temp.startswith('e'): vowelText = "n" elif temp.startswith('i'): vowelText = "n" elif temp.startswith('o'): vowelText = "n" elif temp.startswith('u'): vowelText = "n" else: vowelText = "" output = "I'm on a" + vowelText + " " + coloredText + machine temp = os.popen('sysctl hw.packages') line = temp.readline() cpucount = stripit(line) temp = os.popen('sysctl hw.cputype') temp = temp.readline() cputype = stripit(temp) if cputype == "7": isIntel = 1 temp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 BatteryInstalled') temp = linevalue(temp) if len(temp) > 0: if temp == "Yes":goBat = "Yes" if goBat == "Yes": temp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 MaxCapacity') batMaxCapacity = float(linevalue(temp)) temp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 FullyCharged') fullyCharged = linevalue(temp) temp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 ExternalChargeCapable') pluggedIn = linevalue(temp) if fullyCharged == "Yes": if pluggedIn == "Yes": isCharged = "Yes" if isCharged == "No": temp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 CurrentCapacity') batCurrent = float(linevalue(temp)) batPercent = (batCurrent / batMaxCapacity) * 100 batPercent = int(round(batPercent,0)) batstate = str(batPercent) + "%" else: batstate = "Charged" else: battemp = os.popen('ioreg -n battery -w 0 | grep -m 1 IOBatteryInfo') batline = battemp.readline() batlines = battemp.readlines() if len(batline) > 0: battime = "" goBat = "Yes" batlist = batline.split(',') for x in batlist: temp = x.split('=') if len(temp) > 2: batpropertyvalue = temp[2] temp = temp[1].split('{') batpropertyname = temp[1] else: batpropertyname = temp[0] temp2 = temp[1].split('}') if len(temp2) > 1: batpropertyvalue = temp2[0] else: batpropertyvalue = temp[1] if batpropertyname == "\"Capacity\"": batMaxCapacity = float(batpropertyvalue) elif batpropertyname == "\"Current\"": current = float(batpropertyvalue) elif batpropertyname == "\"Flags\"": flag = int(batpropertyvalue) elif batpropertyname == "\"AbsoluteMaxCapacity\"": designCapacity = int(batpropertyvalue) batpercent = (current / batMaxCapacity) * 100 batpercent = int(round(batpercent,0)) if (flag % 5) == 0: isCharged = "Yes" batstate = "Charged" else: chargeText = "" if len(batlines) > 0: for line in batlines: if line.find("TimeRemaining") != -1: temp = line.split('=') temp = temp[1].strip() timeremaining = int(temp) timeremaining = convertTime(timeremaining,1) battime = " (" + timeremaining + " left)" if (flag % 7) == 0: chargeText = " [Charging]" batstate = str(batpercent) + "%" + battime + chargeText if includeCPU == 1: if isIntel == 1: cmd = "sysctl machdep.cpu.brand_string" temp = os.popen(cmd) line = temp.readline() temp = stripit(line) temp = temp.split("CPU") cpuname = temp[0].strip() else: cmd = "sysctl hw.cpusubtype" temp = os.popen(cmd) line = temp.readline() cpusubtype = stripit(line) cpuname = refCPU(cputype, cpusubtype) if noColor == 0: coloredText = "" output = output + " - CPU: " + coloredText + cpucount + " x " + cpuname if includeCPUSpeed == 1: temp = os.popen('sysctl hw.cpufrequency') line = temp.readline() line = line.split(':') cpuspeed = trim(line[1]) cpuspeed = float(cpuspeed) / 1000000 if cpuspeed >= 1000: cpuspeed = cpuspeed / 1000 if cpuspeed >= 1000: cpuspeed = cpuspeed / 1000 cpuspeedprefix = "T" else: cpuspeedprefix = "G" cpuspeed = round(cpuspeed, 2) else: cpuspeedprefix = "M" cpuspeed = int(cpuspeed) if noColor == 0: coloredText = "" output = output + " - Speed: " + coloredText + str(cpuspeed) + " " + cpuspeedprefix + "Hz" if includeTemp == 1: if noColor == 0: coloredText = "" if isIntel == 0: if int(cpucount) < 2: temp = os.popen('ioreg -n IOHWSensor | awk \'/location/ || /current-value/ || /\"type\"/\' | sed -e \'s/[^"]*\"//\' -e \'s/\" =//\' -e \'s/location//\' -e \'s/type//\' -e \'s/\"//g\' | awk \'{ d=($2/65536); if ($1==\"current-value\") print substr(d,1,7) \"\t\" ; if ($1!=\"current-value\") print $0 }\' | sed -e \'s/temperature/Celsius/\' -e \'s/voltage/volts/\' -e \'s/fanspeed/fan RPM/\' -e \'s/current/Amps/\' -e \'s/^temp$//\' -e \'s/ //\' | awk \'{ if ((NR % 3) == 0) print $0; else printf $0 \" \" }\' | grep CPU | grep Celsius') temp = temp.readline() temp = trim(temp) if len(temp) > 1: tempList = temp.split() cpuTemp = tempList[0] output = output + " - CPU Temp: " + coloredText + cpuTemp + "C" else: templist = os.popen('ioreg -n IOHWSensor | grep -B 3 AD1 | grep -o current-value.*') cpunum = 1 templist = templist.readlines() for x in templist: if len(x) > 1: temp = x.split(' = ') temp = temp[1].strip() cpuTemp = float(temp) / 10 cpuTemp = round(cpuTemp, 1) output = output + " - CPU" + str(cpunum) + " Temp: " + coloredText+ str(cpuTemp) + "C" cpunum = cpunum + 1 temp = os.popen('ioreg -n IOHWSensor | awk \'/location/ || /current-value/ || /\"type\"/\' | sed -e \'s/[^"]*\"//\' -e \'s/\" =//\' -e \'s/location//\' -e \'s/type//\' -e \'s/\"//g\' | awk \'{ d=($2/65536); if ($1==\"current-value\") print substr(d,1,7) \"\t\" ; if ($1!=\"current-value\") print $0 }\' | sed -e \'s/temperature/Celsius/\' -e \'s/voltage/volts/\' -e \'s/fanspeed/fan RPM/\' -e \'s/current/Amps/\' -e \'s/^temp$//\' -e \'s/ //\' | awk \'{ if ((NR % 3) == 0) print $0; else printf $0 \" \" }\' | grep GPU | grep Celsius') temp = temp.readline() temp = trim(temp) if len(temp) > 1: tempList = temp.split() gpuTemp = float(tempList[0]) gpuTemp = round(gpuTemp,1) output = output + " - GPU Temp: " + coloredText+ str(gpuTemp) + "C" else: temp = os.popen('sysctl kern.cpu_temp') temp = temp.readline() if len(temp) > 1: cpuTemp = stripit(temp) output = output + " - CPU Temp: " + coloredText + cpuTemp + "C" if includeBattery == 1: chargestate = "" degtext = "" timetext = "" if noColor == 0: coloredText = "" if goBat == "Yes": if isIntel != 1: temp = batlist[6] temp = temp.split('=') temp = temp[1].split('}') designCapacity = float(temp[0]) else: temp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 DesignCapacity') designCapacity = float(linevalue(temp)) if isCharged == "No": temp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 IsCharging') isCharging = linevalue(temp) if isCharging == "Yes": timetemp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 AvgTimeToFull') chargestate = "" timeTillWhat = "until full" else: timetemp = os.popen('ioreg -w 0 -n AppleSmartBattery | grep -m 1 AvgTimeToEmpty') timeTillWhat = "Left" temp = linevalue(timetemp) timeRemaining = convertTime(temp,1) timetext = "(" + timeRemaining + " " + timeTillWhat + ")" if designCapacity != 0: degredation = (designCapacity - batMaxCapacity) / designCapacity * 100 degredation = int(round(degredation,0)) degtext = "(" + str(degredation) + "% degraded)" output = output + " - Battery: " + coloredText + batstate + " " + chargestate + timetext + " " + degtext else: output = output + " - Battery: " + coloredText+ "none" else: if goBat == "Yes": if showDefault == 1: output = output + " - Battery: " + coloredText + batstate if includeMemory == 1: ### start test.py temp = os.popen('top -l 1 -s 0 | grep PhysMem') line = temp.readline() line = stripit(line) line = trim(line) memlist = line.split(',') temp = memlist[0].split() temp = temp[0] wiredmem = float(temp.rstrip('BkMGTP')) wiredmemunit = temp[-1] wiredmeminbytes = convertMemoryToBytes(wiredmem, wiredmemunit) temp = memlist[1].split() temp = temp[0] activemem = float(temp.rstrip('BkMGTP')) activememunit = temp[-1] activememinbytes = convertMemoryToBytes(activemem, activememunit) temp = memlist[2].split() ### end test.py temp = temp[0] inactivemem = float(temp.rstrip('BkMGTP')) inactivememunit = temp[-1] inactivememinbytes = convertMemoryToBytes(inactivemem, inactivememunit) usedmeminbytes = wiredmeminbytes + activememinbytes + inactivememinbytes temp = os.popen('sysctl hw.memsize') temp = temp.readline() totalmeminbytes = float(stripit(temp)) mempercent = int(round(((usedmeminbytes / totalmeminbytes) * 100),0)) usedmem = usedmeminbytes usedmemunit = 'B' while usedmem >= 1024.0: usedmem = usedmem / 1024.0 if usedmemunit == 'B': usedmemunit = 'k' elif usedmemunit == 'k': usedmemunit = 'M' elif usedmemunit == 'M': usedmemunit = 'G' elif usedmemunit == 'G': usedmemunit = 'T' elif usedmemunit == 'T': usedmemunit = 'P' else: usedmemunit = 'E' totalmem = totalmeminbytes totalmemunit = 'B' while totalmem >= 1024.0: totalmem = totalmem / 1024.0 if totalmemunit == 'B': totalmemunit = 'k' elif totalmemunit == 'k': totalmemunit = 'M' elif totalmemunit == 'M': totalmemunit = 'G' elif totalmemunit == 'G': totalmemunit = 'T' elif totalmemunit == 'T': totalmemunit = 'P' else: totalmemunit = 'E' usedmem = round(usedmem,1) freebar = int(mempercent) / 10 if noColor != 0: membar = "[" else: membar = "[04" barchar = "|" for i in range(10): if i == freebar: if noColor == 0: membar = membar + "14" else: barchar = "-" membar = membar + barchar membar = membar + "" + coloredText + "]" if noColor == 0: coloredText = "" output = output + " - RAM Usage: " + coloredText + str(usedmem) + " " + usedmemunit + "B / " + str(totalmem) + " " + totalmemunit + "B " + membar if includeHD == 1: if noColor == 0: coloredText = "" temp = os.popen('df -lm | awk \'BEGIN {getline; while (getline temp > 0) { split(temp,a," "); total1 += a[4]; total2 += a[2] } }END {print total1,total2}\'') line = temp.readline() line = trim(line) hdlist = line.split(' ') hdfree = int(hdlist[0]) hdcapacity = int(hdlist[1]) if hdfree > 1048576: hdfree = float(hdfree) / 1048576 hdfreeunit = "TB" elif hdfree > 1024: hdfree = float(hdfree) / 1024 hdfreeunit = "GB" else: hdfreeunit = "MB" hdfree = round(hdfree, 2) if hdcapacity > 1048576: hdcapacity = float(hdcapacity) / 1048576 hdcapacityunit = "TB" elif hdcapacity > 1024: hdcapacity = float(hdcapacity) / 1024 hdcapacityunit = "GB" else: hdcapacityunit = "MB" hdcapacity = round(hdcapacity, 2) output = output + " - Disk Space: " + coloredText + str(hdcapacity) + " " + hdcapacityunit + " with " + str(hdfree) + " " + hdfreeunit + " Free" if includeGraphics == 1: resInfo = "" resList = [] temp = os.popen("system_profiler SPDisplaysDataType") templist = temp.readlines() temp = trim(templist[2]) gfxCard = temp.rstrip(':') for x in templist: line = x.split(": ") if len(line) > 1: temp = line[0].strip() if temp == "Resolution": temp2 = line[1].split('@') resList.append(temp2[0].strip()) if noColor == 0: coloredText = "" if len(resList) > 1: for x in range(len(resList)): resInfo = resInfo + " - Resolution " + str(x+1) + ": " + coloredText + resList[x] else: resInfo = " - Resolution: " + coloredText + resList[0] output = output + " - Graphics: " + coloredText + gfxCard + resInfo if includeOS == 1: if noColor == 0: coloredText = "" temp = os.popen('sw_vers') line = temp.readline() osname = line.split(':') osname = trim(osname[1]) line = temp.readline() osversion = line.split(':') osversion = trim(osversion[1]) line = temp.readline() osbuild = line.split(':') osbuild = trim(osbuild[1]) output = output + " - Running: " + coloredText + osname + " " + osversion + " (" + osbuild + ")" if includeProcessCount == 1: if noColor == 0: coloredText = "" temp = os.popen('ps -ax | wc -l') line = temp.readline() processCount = trim(line) output = output + " - Processes: " + coloredText + str(processCount) if includeUptime == 1: uptime = "" temp = os.popen('uptime | grep up') temp = temp.readline() temp = temp.split("user") temp = temp[0].split("up ") temp = temp[1].split(',') for x in range(len(temp)-1): uptime = uptime + temp[x] + "," uptime = uptime.rstrip(', ') uptime = uptime.strip() output = output + " - Uptime: " + coloredText + uptime if silentMode == 1: xchat.prnt("04 " + output) else: xchat.command("SAY " + output) os.system('rm -rf temp.info') def getTunes (args): global includeColor outColor = 7 goFull = 0 goiTunes = 1 goRealplayer = 0 includeArtist = 1 includeYear = 0 includeBitrate = 0 includeCount = 0 includeRating = 0 includeTime = 0 includeKind = 0 streamBypass = 0 includeURL = 0 includeLib = 0 silentMode = 0 addons = "" allGood = 0 cmd = 'osascript -e "tell application \\"iTunes\\" to return podcast of current track & \\"|\\" & player state & \\"|\\" & kind of current track & \\"|\\" & current stream title & \\"|\\" & name of current track & \\"|\\" & artist of current track & \\"|\\" & album of current track & \\"|\\" & bit rate of current track' argIndex = 8 yearIndex = 0 countIndex = 0 ratingIndex = 0 timeIndex = 0 libIndex = 0 noColor = 0 boldText = "" arglength = len(args) if arglength > 1: i = 1 while i < arglength: temp = args[i] if temp == "real": goiTunes = 0 goRealplayer = 1 if temp == "year": includeYear = 1 if temp == "bitrate": includeBitrate = 1 if temp == "count": includeCount = 1 if temp == "rating": includeRating = 1 if temp == "time": includeTime = 1 if temp == "kind": includeKind = 1 if temp == "url": includeURL = 1 if temp == "lib": includeLib = 1 if temp == "full": includeYear = 1 includeBitrate = 1 includeCount = 1 includeRating = 1 includeTime = 1 includeKind = 1 includeURL = 1 includeLib = 1 if temp.isdigit(): if int(temp) >= 0 and int(temp) <= 15: outColor = temp if temp == "nocolor": noColor = 1 if temp == "silent": silentMode = 1 i = i + 1 # IMPORTANT: This section MUST be in CORRECT ORDER, as it assigns index values if includeYear == 1: cmd = cmd + '& \\"|\\" & year of current track' yearIndex = argIndex argIndex = argIndex + 1 if includeCount == 1: cmd = cmd + '& \\"|\\" & played count of current track' countIndex = argIndex argIndex = argIndex + 1 if includeRating == 1: cmd = cmd + '& \\"|\\" & rating of current track' ratingIndex = argIndex argIndex = argIndex + 1 if includeTime == 1: cmd = cmd + '& \\"|\\" & player position & \\"|\\" & time of current track' timeIndex = argIndex lengthIndex = argIndex + 1 argIndex = argIndex + 2 cmd = cmd + '"' if noColor == 1: boldText = "" if goiTunes == 1: if checkitunes(1) < 1: print "ATTENTION: iTunes is not running!" else: temp = os.popen(cmd) line = temp.readline() line = trim(line) tuneList = line.split(', |, ') if len(tuneList) < 2: print "ATTENTION: Nothing is currently playing in iTunes!" else: temp = tuneList[0] if temp == "true": playerStatus = "Podcast" else: playerStatus = tuneList[1] playerStatus = playerStatus.capitalize() fileType = tuneList[2] title = tuneList[4] artist = tuneList[5] if fileType.find("stream") != -1 or fileType == "missing value": includeBitrate = 1 streamBypass = 1 playerStatus = "Streaming" streamName = tuneList[3] if len(artist) < 1 or artist == "missing value": includeArtist = 0 server = title addons = "- " + boldText + "Server: " + server title = streamName if title == "missing value": title = "Untitled" album = tuneList[6] if includeArtist == 1: if len(artist) > 0 and artist != "missing value": addons = "- " + boldText + "Artist: " +artist if len(album) > 0 and album != "missing value": addons = addons + " - " + boldText + "Album: " + album if includeYear == 1: year = tuneList[yearIndex] if year != "missing value" and year != "0": addons = addons + " - " + boldText + "Year: " + year if includeBitrate == 1: bitrate = tuneList[7] if bitrate != "missing value" and bitrate != "0": addons = addons + " - " + boldText + "Bitrate: " + bitrate + " kb/s" if includeCount == 1: count = tuneList[countIndex] if count != "missing value": addons = addons + " - " + boldText + "Play Count: " + count if includeRating == 1: if noColor == 0: ratingBar = "[03" else: ratingBar = "[" rating = tuneList[ratingIndex] if rating == "missing value": rating = 0 else: rating = int(rating) / 20 barchar = "|" for x in range(5): if x == rating: if noColor == 0: ratingBar = ratingBar + "14" else: barchar = "-" ratingBar = ratingBar + barchar ratingBar = ratingBar + "]" addons = addons + " - " + boldText + "Rating: " + ratingBar if includeTime == 1: elapsed = tuneList[timeIndex] elapsed = convertTime(elapsed, 1) totalTime = tuneList[lengthIndex] addons = addons + " - " + boldText + "Elapsed: " + elapsed if totalTime != "missing value": addons = addons + " / " + totalTime if includeKind == 1: if streamBypass != 1: if fileType != "missing value": addons = addons + " - " + boldText + "Kind: " + fileType if includeLib == 1: addons = addons + " - " + boldText + "Playlist: " + getTuneLibSize(1) if includeURL == 1: if fileType.find("stream") != -1 or fileType == "missing value": temp = os.popen('osascript -e "tell application \\"itunes\\" to return address of current track"') temp = temp.readline() url = trim(temp) if url.find("pri.kts-af.net") == -1: addons = addons + " - " + boldText + "URL: " + url allGood = 1 else: if checkRealplayer(1) < 1: print "ATTENTION: RealPlayer is not running!" else: temp = os.popen('osascript -e "tell application \\"RealPlayer\\" to return state of window 1 & \\"|\\" & URL of window 1 & \\"|\\" & clip title of window 1 & \\"|\\" & encoded bitrate of window 1 & \\"|\\" & clip position of window 1 & \\"|\\" & clip length of window 1 & \\"|\\" & original clip size of window 1"') line = temp.readline() line = trim(line) tuneList = line.split(', |, ') playerStatus = tuneList[0] playerStatus = playerStatus.capitalize() duration = tuneList[5] if float(duration) < 0: includeDuration = 0 if playerStatus == "Playing": playerStatus = "Streaming" else: includeDuration = 1 duration = convertTime(duration, 1) title = tuneList[2] title = title.capitalize() if includeBitrate == 1 or goFull == 1: bitrate = tuneList[3] bitrate = float(bitrate) / 1000 bitrate = int(bitrate) if bitrate > 0: addons = addons + " - " + boldText + "Bitrate: " + str(bitrate) + " kb/s" if includeTime == 1 or goFull == 1: elapsed = tuneList[timeIndex] elapsed = convertTime(elapsed, 1) addons = addons + " - " + boldText + "Elapsed: " + elapsed if includeDuration == 1: addons = addons + " / " + duration if includeURL == 1 or goFull == 1: url = tuneList[1] if includeDuration != 1: addons = addons + " - " + boldText + "URL: " + url allGood = 1 if allGood == 1: output = "" if noColor == 0: output = "" + str(outColor) output = output + "{" + playerStatus+ "} \"" + title + "\" " + addons if silentMode == 1: xchat.prnt("04 " + output) else: xchat.command("SAY " + output) def getMovies (args): global includeColor outColor = 7 goFull = 0 includeResolution = 0 includeTime = 0 noColor = 0 silentMode = 0 output = "" boldText="" if checkQuicktime(1) < 1: print "ATTENTION: QuickTime is not currently running!" else: arglength = len(args) if arglength > 1: i = 1 while i < arglength: temp = args[i] if temp == "res" or temp == "full": includeResolution = 1 if temp == "time" or temp == "full": includeTime = 1 if temp.isdigit(): if int(temp) >= 0 and int(temp) <= 15: outColor = temp if temp == "nocolor": noColor = 1 if temp == "silent": silentMode = 1 i = i + 1 if noColor == 1: boldText = "" temp = os.popen('osascript -e "tell application \\"QuickTime Player\\" to return live stream of movie 1 & \\"|\\" & playing of movie 1 & \\"|\\" & name of movie 1 & \\"|\\" & duration of movie 1 & \\"|\\" & current time of movie 1 & \\\"|\\" & time scale of movie 1 & \\"|\\" & natural dimensions of movie 1"') temp = temp.readline() temp = trim(temp) movieList = temp.split(', |, ') if len(movieList) < 2: print "ATTENTION: No movie is loaded in QuickTime!" else: isStream = movieList[0] isPlaying = movieList[1] if isStream == "true": playerStatus = "Streaming" elif isPlaying == "true": playerStatus = "Watching" else: playerStatus = "Stopped" title = movieList[2] title = title.strip('\x00') if noColor == 0: output = "" + str(outColor) output = output + "{" + playerStatus + "} \"" + title + "\"" if includeResolution == 1 or goFull == 1: temp = movieList[6] dimensions = temp.split(', ') dimensionX = dimensions[0] dimensionY = dimensions[1] if dimensionX != "0" or dimensionY != "0": output = output + " - " + boldText + "Resolution: " + dimensionX + " x " + dimensionY totalTime = movieList[3] scale = movieList[5] totalTime = convertTime(totalTime, scale) if includeTime == 1 or goFull == 1: elapsed = movieList[4] elapsed = convertTime(elapsed, scale) output = output + " - " + boldText + "Elapsed: " + elapsed + " / " + totalTime else: output = output + " - " + boldText + "Duration: " + totalTime if silentMode == 1: xchat.prnt("04 " + output) else: xchat.command("SAY " + output) def getTuneLibSize(bleh): unit = "B" temp = os.popen('osascript -e "tell application \\"iTunes\\" to return name of current playlist & \\"|\\" & size of current playlist"') temp = temp.readline() temp = trim(temp) temp = temp.split('|') libName = temp[0] output = "\"" + libName + "\"" libSize = temp[1] if libSize != "missing value": libSize = float(libSize) if libSize > 1024: libSize = libSize / 1024 if libSize > 1024: libSize = libSize / 1024 if libSize > 1024: libSize = libSize / 1024 if libSize > 1024: libSize = libSize / 1024 unit = "TB" else: unit = "GB" else: unit = "MB" else: unit = "KB" libSize = round(libSize,2) output = output + " @ " + str(libSize) + " " + unit return output def checkChannelModes (word, word_eol, userdata): global includeColor modes = word[1] if modes.find('c') != -1: includeColor = 0 else: includeColor = 1 return xchat.EAT_XCHAT def checkitunes (bleh): temp = os.popen('ps -cx | grep -c iTunes') itunecount = temp.readline() itunecount = int(trim(itunecount)) if itunecount > 0: temp = os.popen('ps -cx iTunesHelper| grep -c iTunesHelper') temp = temp.readline() temp = int(trim(temp)) itunecount = itunecount - temp return itunecount # Returns 0 if both folders have write permissions # Returns 1 if the X-Chat Aqua directory does not have write permissions # Returns 2 if the Plugins directory does not write permissions def checkPermissions (bleh): test = os.popen('ls -dl ./') temp = test.readline() temp = temp.split() results = 0 apppermission = temp[0] if apppermission.find("drw") == -1: results = 1 else: test = os.popen('ls -dl Plugins') temp = test.readline() temp = temp.split() pluginpermission = temp[0] if pluginpermission.find("drw") == -1: results = 2 return results def checkQuicktime (bleh): temp = os.popen('ps -cx | grep -c QuickTime\ Player') quicktimeCount = temp.readline() quicktimeCount = int(trim(quicktimeCount)) return quicktimeCount def checkRealplayer (args): temp = os.popen('ps -cx | grep -c RealPlayer') realplayerCount = temp.readline() realplayerCount = int(trim(realplayerCount)) return realplayerCount def checkUpdate (args): goUpdate = 0 latestVersion = getVersion(1) if str(latestVersion) != "0": if str(__module_version__) != str(latestVersion): goUpdate = 1 else: goUpdate = 2 return goUpdate def convertMemoryToBytes (mem, memunit): if memunit == 'E': meminbytes = mem * pow(1024,5) elif memunit == 'P': meminbytes = mem * pow(1024,4) elif memunit == 'G': meminbytes = mem * pow(1024,3) elif memunit == 'M': meminbytes = mem * pow(1024,2) elif memunit == 'k': meminbytes = mem * 1024 else: meminbytes = usedmem return meminbytes def convertTime (time, scale): theTime = "" hr = 0 mins = 0 totaltime = float(time) / float(scale) if totaltime > 60: totaltime = totaltime / 60.0 if totaltime > 60: totaltime = totaltime / 60.0 hr = int(totaltime) theTime = str(hr) + ":" totaltime = (totaltime % 1) * 60 mins = int(totaltime) if hr > 0: mins = "%02i" % (mins) totaltime = (totaltime % 1) * 60 sec = copy.copy(totaltime) sec = "%02i" % (sec) theTime = str(theTime) + str(mins) + ":" + str(sec) return theTime def domacversion (word, word_eol, userdata): printmacversion(1) return xchat.EAT_ALL def domacinfo (word, word_eol, userdata): getinfo(word) return xchat.EAT_ALL def domacmovie (word, word_eol, userdata): getMovies(word) return xchat.EAT_ALL def domactunes (word, word_eol, userdata): getTunes(word) return xchat.EAT_ALL def domacupdate (word, word_eol, userdata): if checkPermissions(1) == 1: print "ATTENTION: You need write permissions for your X-Chat Aqua folder. Navigate to the folder in Finder, go to File -> Get Info, and set 'You can' to 'Read & Write'. Update cancelled." elif checkPermissions(1) == 2: print "ATTENTION: You need write permissions for your Plugins folder. Navigate to the folder in Finder, go to File -> Get Info, and set 'You can' to 'Read & Write'. Update cancelled." else: latestVersion = getVersion(1) canUpdate = checkUpdate(1) if canUpdate == 1: print "08You have aVirtualInferno version " + __module_version__ + ". The latest version is " + latestVersion + ". Now updating..." try: os.system('curl -m 7 -s -B http://oven.virtualinferno.net/avirtualinferno2.zip -o avirtualinferno2.zip') os.system('unzip -o -qq avirtualinferno2.zip -d aviunzipped') os.system('cp -f aviunzipped/avirtualinferno2.pkg/Contents/Archive.pax.gz aviunzipped') os.system('gunzip -f -q aviunzipped/Archive.pax') os.system('pax -r < aviunzipped/Archive.pax') os.system('rm ' + xchatdir + '/avirtualinferno.py') os.system('mv avirtualinferno.py ' + xchatdir + '/avirtualinferno.py') xchat.command('PY LOAD avirtualinferno.py') except: print "An error has occurred trying to install the update. Please try again later." os.system('rm -rf aviunzipped') os.system('rm avirtualinferno2.zip') elif canUpdate == 2: print "04ERROR: Unable to contact update server. Please try again later." else: print "03aVirtualInferno version " + __module_version__ + " is already up-to-date." return xchat.EAT_ALL # This method works for US zipcodes only def domacweather (word, word_eol, userdata): global includeColor location = "" cityname = "" postalcode = "" spacer = "" output = "" temp_c = "" temp_f = "" wind_dir = "" wind_mph = "" boldText = "" dewpoint_f = "" dewpoint_c = "" heat_index_f = "" heat_index_c = "" windchill_f = "" windchill_c = "" visibility_mi = "" visibility_km = "" goFull = 0 includePressure = 0 includeHumidity = 0 includeWind = 0 includeDewpoint = 0 includeHeatindex = 0 includeWindchill = 0 includeVisibility = 0 isGood = 1 cityFound = 0 weatherFound = 0 noColor = 0 silentMode = 0 arglength = len(word) if arglength > 1: i = 1 while i < arglength: arg = word[i] arg = arg.strip(',') if arg.isalpha() == 0: if arg.isdigit() == 0: if len(arg) == 3: if i < (arglength - 1): arg2 = word[i+1] if arg2.isalpha() == 0: if arg2.isdigit() == 0: if len(arg2) == 3: postalcode = arg + "%20" + arg2 else: postalcode = arg else: if arg == "full": includePressure = 1 includeHumidity = 1 includeWind = 1 includeHumidity = 1 includeDewpoint = 1 includeHeatindex = 1 includeWindchill = 1 includeVisibility = 1 elif arg == "pressure": includePressure = 1 elif arg == "humidity": includeHumidity = 1 elif arg == "wind": includeWind = 1 elif arg == "humidity": includeHumidity = 1 elif arg == "dewpoint": includeDewpoint = 1 elif arg == "heatindex": includeHeatindex = 1 elif arg == "windchill": includeWindchill = 1 elif arg == "visibility": includeVisibility = 1 elif arg == "nocolor": noColor = 1 elif arg == "silent": silentMode = 1 else: if spacer == "": if len(cityname) > 0: spacer = "%20" cityname = cityname + spacer + arg i = i + 1 if len(postalcode) < 1: if len(cityname) < 1: isGood = 0 else: location = cityname else: if postalcode == "": isGood = 0 else: location = postalcode else: isGood = 0 if noColor == 1: boldText = "" if isGood == 0: print "ERROR: No location specified!" else: url = "http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=" + location cmd = "curl -m 5 " + url temp = os.popen(cmd) lines = temp.readlines() for line in lines: lineList = "" temp = line.split('>') # print temp attribute = temp[0].lstrip('\t <') if len(temp) > 1: temp2 = temp[1].split("<") value = temp2[0] if cityFound == 0: if attribute == "full": if len(value) > 0: city = value cityFound = 1 if weatherFound == 0: if attribute == "station_id": if len(value) > 0: weatherFound = 1 else: if attribute == "weather": conditions = value elif attribute == "temp_f": temp_f = value elif attribute == "temp_c": temp_c = value if includeHumidity == 1: if attribute == "relative_humidity": output = output + " - Humidity: " + boldText + value includeHumidity = 0 if includeWind == 1: if attribute == "wind_dir": wind_dir = value if attribute == "wind_mph": wind_mph = value if (len(wind_dir) > 0 and len(wind_mph) > 0): output = output + " - Wind: " + boldText + wind_dir + " @ " + wind_mph + " MPH" includeWind = 0 if includePressure == 1: if attribute == "pressure_string": output = output + " - Pressure: " + boldText + value includePressure = 0 if includeDewpoint == 1: if attribute == "dewpoint_f": dewpoint_f = value if attribute == "dewpoint_c": dewpoint_c = value if (len(dewpoint_f) > 0 and len(dewpoint_c) > 0): output = output + " - Dew Point: " + boldText + dewpoint_f + "F (" + dewpoint_c + "C)" includeDewpoint = 0 if includeHeatindex == 1: if attribute == "heat_index_f": heat_index_f = value if attribute == "heat_index_c": heat_index_c = value if (len(heat_index_f) > 0 and len(heat_index_c) > 0): if heat_index_f != "NA": output = output + " - Heat Index: " + boldText + heat_index_f + "F (" + heat_index_c + "C)" includeHeatindex = 0 if includeWindchill == 1: if attribute == "windchill_f": windchill_f = value if attribute == "windchill_c": windchill_c = value if (len(windchill_f) > 0 and len(windchill_c) > 0): if windchill_f != "NA": output = output + " - Windchill: " + boldText + windchill_f + "F (" + windchill_c + "C)" includeWindchill = 0 if includeVisibility == 1: if attribute == "visibility_mi": visibility_mi = value if attribute == "visibility_km": visibility_km = value if (len(visibility_mi) > 0 and len(visibility_km) > 0): if visibility_mi != "NA": output = output + " - Visibility: " + boldText + visibility_mi + " mi (" + visibility_km + " km)" includeVisibility = 0 tempinfo = temp_f + "F (" + temp_c + "C)" if weatherFound == 1: saytext = "Weather for " + boldText + city + " - Current Weather: " + boldText + conditions + " - Temperature: " + boldText + tempinfo + output if silentMode == 1: xchat.prnt("04 " + saytext) else: xchat.command("SAY " + saytext) else: print "ERROR: City not found!" return xchat.EAT_ALL def doNotPrintCreation(word, word_eol, userdata): return xchat.EAT_XCHAT def doTinyURL(word, word_eol, userdata): global previousBoard length = len(word_eol) cmd = "curl -m 5 -s http://tinyurl.com/api-create.php?url=" + word[length-1] temp = os.popen(cmd) url = temp.readline() output = "" if length > 2: for x in range(1,length-1): output = output + word[x] + " " output = output + url xchat.command("SAY " + output) else: if len(url) > 0: pasteboard = os.popen('pbpaste', 'r+') previousBoard = pasteboard.read() pasteboard.close() pasteboard = os.popen("pbcopy", 'w') pasteboard.write(url) pasteboard.close() print "05Copied \"" + url + "\" to the pasteboard" else: print "Connection to TinyURL failed. Please try again." return xchat.EAT_ALL def doIsGd(word, word_eol, userdata): global previousBoard length = len(word_eol) cmd = "curl -m 5 -s http://is.gd/api.php?longurl=" + word[length-1] temp = os.popen(cmd) url = temp.readline() output = "" if length > 2: for x in range(1,length-1): output = output + word[x] + " " output = output + url xchat.command("SAY " + output) else: if len(url) > 0: pasteboard = os.popen('pbpaste', 'r+') previousBoard = pasteboard.read() pasteboard.close() pasteboard = os.popen("pbcopy", 'w') pasteboard.write(url) pasteboard.close() print "05Copied \"" + url + "\" to the pasteboard" else: print "Connection to is.gd failed. Please try again." return xchat.EAT_ALL def doRestorePasteboard(word, word_eol, userdata): global previousBoard pasteboard = os.popen("pbcopy", 'w') pasteboard.write(previousBoard) pasteboard.close() print "05Restored \"" + previousBoard + "\" to the pasteboard" previousBoard = "" return xchat.EAT_ALL def doMacAge(word, word_eol, userdata): dateIsGood = 1 if len(word_eol) > 1: yearIndex = 0 monthIndex = 0 dayIndex = 0 currentTime = time.localtime() currentYear = int(currentTime[0]) oldestPerson = 1902 bdayLine = word[1] bdayList = bdayLine.split('/') for x in range(len(bdayList)): temp = int(bdayList[x]) if temp >= oldestPerson: yearIndex = x elif temp > 12: if temp <= 31: dayIndex = x elif temp < 100: bdayList[x] = temp + 1900 yearIndex = x else: dateIsGood = 0 elif temp < 12: monthIndex = x else: dateIsGood = 0 if dateIsGood == 1: temp = str(bdayList[monthIndex])+"/"+str(bdayList[dayIndex])+"/"+str(bdayList[yearIndex]) bday = time.strptime(temp, "%m/%d/%Y") timeDifference = time.mktime(currentTime) - time.mktime(bday) ageInYears = timeDifference/float(31556926) xchat.command("ME is "+ str(ageInYears) + " years old") else: print "ERROR: Invalid date or format specified!" else: print "No birthdate specified!" return xchat.EAT_ALL def fixy2k(o,indexToFix): newDate = "" oldYear = oldDate[indexToFix] oldDate[indexToFix] = oldYear + 1900 for x in oldDate: newDate = newDate + str(x) + "/" newDate = newDate.rstrip('/') return newDate def getUpdate (args): print xchatdir def getVersion (args): temp = os.popen('curl -m 3 -s http://oven.virtualinferno.net/macversion') temp = temp.readline() if len(temp) > 0: latestVersion = trim(temp) else: latestVersion = "0" return latestVersion def printmacversion (args): print "07=====aVirtualInferno version " + __module_version__ +"=====" def refCPU (cputype, cpusubtype): cput = int(cputype) cpust = int(cpusubtype) # NOTE: THE INTEL SECTION IS DEPRECATED # if cput == 7: # make = "Intel" # if cpust == 12: model = "Xeon" # elif cpust == 11: model = "Itanium" # elif cpust == 10: model = "Pentium 4" # elif cpust == 9: model = "Pentium M" # elif cpust == 8: model = "Pentium 3" # elif cpust == 7: model = "Celeron" # elif cpust == 6: model = "Pentium II" # elif cpust == 5: model = "Pentium" # elif cpust == 4: # temp = os.popen('sysctl hw.cpufamily machdep.cpu.cores_per_package') # cpufamily = temp.readline() # cpufamily = stripit(cpufamily) # if cpufamily == "1114597871": family = "Core 2" # elif cpufamily == "2028621756": family = "Core 2" # elif cpufamily == "1943433984": family = "Core" # else: family = "Core-Based" # count = temp.readline() # count = stripit(count) # if count == "1": model = family + " Solo" # elif count == "2": model = family + " Duo" # elif count == "4": model = family + " Quad" # elif count == "8": model = family + " Octo" # else: model = "486 Compatible" # elif cpust == 3: model = "386 Compatible" # else: model = "Processor" if cput == 18: make = "PowerPC" if cpust == 100: model = "G5" elif cpust == 11: model = "G4" elif cpust == 10: model = "G4" elif cpust == 9: model = "G3" elif cpust == 8: model = "620" elif cpust == 7: model = "604e" elif cpust == 6: model = "604" elif cpust == 5: model = "603ev" elif cpust == 4: model = "603e" elif cpust == 3: model = "603" elif cpust == 2: model = "602" elif cpust == 1: model = "601" else: model = "Processor" else: make = "Unknown" model = "Processor" return make + " " + model # The following section is used for adding updated models def refMachineType (name): if name == "MacBook2,1": machine = "MacBook" elif name == "MacBook6,1": machine = "MacBook" elif name == "MacBook5,1": machine = "MacBookUnibody" elif name == "MacBookPro5,1": machine = "MacBookPro15Unibody" elif name == "MacBookPro5,2": machine = "MacBookPro17Unibody" elif name == "MacBookPro5,3": machine = "MacBookProUnibody" elif name == "MacBookPro5,4": machine = "MacBookPro15Unibody" elif name == "MacBookPro5,5": machine = "MacBookPro13" elif name == "MacBookPro2,1": machine = "MacBookPro17" elif name == "MacBookPro2,2": machine = "MacBookPro15" elif name == "MacBookPro3,1": machine = "MacBookPro15" elif name == "MacBookPro3,2": machine = "MacBookPro17" elif name == "AppleTV1,1": machine = "AppleTV" elif name == "iMac7,1": machine = "iMac" elif name == "U-100": machine = "MSI Wind" else: machine = "" return machine def refModel (name): if name == "Xserve": model = "Xserve" elif name == "XserveG5": model = "Xserve G5" elif name == "Macmini": model = "Mac mini" elif name == "eMac": model = "eMac" elif name == "iMac": model = "iMac" elif name == "iMacG5": model = "iMac G5" elif name == "PowerMacG3": model = "Power Macintosh G3" elif name == "PowerMacG3Series": model = "Power Macintosh G3 Series" elif name == "PowerMacG3PCI": model = "Power Mac G3 (PCI graphics)" elif name == "PowerMacG4AGP": model = "Power Mac G4 (AGP graphics)" elif name == "PowerMacG4": model = "Power Mac G4" elif name == "PowerMacG4Cube": model = "Power Mac G4 Cube" elif name == "PowerMacG5": model = "Power Mac G5" elif name == "MacPro": model = "Mac Pro" elif name == "iBook": model = "iBook" elif name == "iBookG4": model = "iBook G4" elif name == "PowerBookG3Series": model = "PowerBook G3 Series" elif name == "PowerBook": model = "PowerBook" elif name == "PowerBookG4": model = "PowerBook G4" elif name == "PowerBookG415": model = "PowerBook G4 15\"" elif name == "PowerBookG417": model = "PowerBook G4 17\"" elif name == "PowerBookG412": model = "PowerBook G4 12\"" elif name == "MacBookPro15": model = "MacBook Pro 15\"" elif name == "MacBookPro17": model = "MacBook Pro 17\"" elif name == "MacBookPro": model = "MacBook Pro" elif name == "MacBook": model = "MacBook" elif name == "AppleTV": model = "Apple TV" elif name == "MacBookAir": model = "MacBook Air" elif name == "MacBookUnibody": model = "MacBook (Unibody)" elif name == "MacBookPro15Unibody": model = "MacBook Pro 15\" (Unibody)" elif name == "MacBookPro17Unibody": model = "MacBook Pro 17\" (Unibody)" elif name == "MacBookProUnibody": model = "MacBook Pro (Unibody)" elif name == "MacBookPro13": model = "MacBook Pro 13\"" else: model = "" return model def refGenericModel(name): if name.find("MacBookPro") != -1: model = "MacBook Pro" elif name.find("MacBookAir") != -1: model = "MacBook Air" elif name.find("MacBook") != -1: model = "MacBook" elif name.find("MacPro") != -1: model = "Mac Pro" elif name.find("PowerBook") != -1: model = "PowerBook" elif name.find("iBook") != -1: model = "iBook" elif name.find("PowerMac") != -1: model = "Power Mac" elif name.find("iMac") != -1: model = "iMac" elif name.find("eMac") != -1: model = "eMac" elif name.find("XServe") != -1: model = "Xserve" elif name.find("Mac") != -1: model = "Mac" else: model = "Unknown System" return model def linevalue(line): temp = line.readline() if len(temp) > 0: temp = temp.split('=') temp = temp[1] temp = trim(temp) return temp def stripit (line): temp = line.split(':') temp = temp[1].strip('\n') temp = temp.strip() return temp def trim (line): temp = line.strip(':') temp = temp.strip('\n') temp = temp.strip() temp = temp.strip("| | \"") temp = temp.strip('\"') return temp # Startup Commands printmacversion(1) previousBoard = os.popen("pbpaste", 'r+').read() # X-Chat Aqua Hooks xchat.hook_command("macversion", domacversion, help="/macversion - Displays plugin version.") xchat.hook_command('macinfo', domacinfo, help="/macinfo - Displays Macintosh info. Arguments (do not include quotes): 07'silent'-restricts command output to local display only. 07'full'-output the info from the flags below. 07'cpu'-include the CPU count and CPU type. 07'speed'-include the CPU(s) speed. 07'temp'-include the CPU and GPU temp (if possible). 07'ram'-include the RAM usage information. 07'hd'-include storage capacity information, 'os'-include operating system version information. 07'process'-include the running process count. 07'res'-includes the resolution for all displays connected. 07'uptime'-include the system uptime") xchat.hook_command('macmovie', domacmovie, help="/macmovie - Displays information about currently playing window in QuickTime. Arguments (do not include quotes): 07'silent'-restricts command output to local display only. 07'full'-output the info from the flags below. 07'#'-output the info in the MIRC color of your choice. 07'res'-include the resolution of the foreground movie. 07'time'-include the elapsed and total time of the foreground movie.") xchat.hook_command('mactunes', domactunes, help="/mactunes - Displays information about currently playing item in iTunes (default) or RealPlayer. Arguments (do not include quotes): 07'silent'-restricts command output to local display only. 07'#'-output the info in the MIRC color of your choice. 07'real'- Output RealPlayer information instead of iTunes. 07'full'-output the info from the flags below. 07'bitrate'-includes the bitrate of the current item. 07'count'-includes the play count of the currently playing item. 07'rating'-include the rating of the current playing item. 07'time'-includes the current time position and duration (if possible). 07'length'-includes just the duration of the current item. 07'year'-includes the year of the currently playing item, 'url'-includes the URL of the currently playing item, if the item is a stream.") xchat.hook_command('macupdate', domacupdate, help="/macupdate - Checks latest version") xchat.hook_command('macweather', domacweather, help="/macweather POSTAL CODE or CITY - Displays the current weather conditions for a given city. Arguments (do not include quotes): 07'silent'-restricts command output to local display only. 07'full'-output the info from the flags below. 07'humidity'-includes the humidity percentage. 07'pressure'-includes atmospheric pressure information. 07'wind'-includes windspeed and directional information. 07'dewpoint' includes the dew point. 07'heatindex' includes the heat index. 07'windchill' includes the windchill factor. 07'visibility' includes the visibility ceiling.") xchat.hook_command('mis', doIsGd, help="/mis (text) URL - Shortens a given URL using is.gd. If no (text) is given, the shortened URL is copied to the pasteboard. If (text) is provided before the URL, then the command will output the text with shortened URL to the chat.") xchat.hook_command('mtu', doTinyURL, help="/mtu (text) URL - Shortens a given URL using TinyURL. If no (text) is given, the shortened URL is copied to the pasteboard. If (text) is provided before the URL, then the command will output the text with shortened URL to the chat.") xchat.hook_command('pb', doRestorePasteboard, help="/pb - Restores the previous pasteboard contents from the last /mut or /mtu command") xchat.hook_command("macage", doMacAge, help="/macage BIRTHDAY - Displays age in years. BIRTHDAY must be specified as MM/DD/YYYY, DD/MM/YYYY, or YYYY/MM/DD")