Exemple #1
0
def get_uptime():
    if plugins.is_windows():
        import ctypes
        import time
        millis = ctypes.WinDLL("kernel32").GetTickCount64()
        days = millis / 86400000
        millis -= 86400000 * days
        hours = millis / 3600000
        millis -= 3600000 * hours
        mins = millis / 60000
        upstr = "%02d:%02d" % (hours, mins)
        if days != 0:
            upstr = "%d days, %s" % (days, upstr)
        return "%s up %s" % (time.strftime("%H:%M:%S"), upstr)
    else:
        from subprocess import Popen, PIPE
        return Popen(["uptime"], stdout=PIPE).communicate()[0].strip()
Exemple #2
0
print "youtube init"
import plugins
import urllib2
import json
import re, traceback
import locale
locale.setlocale(locale.LC_ALL, "US" if plugins.is_windows() else "en_US")

API_KEY = "your api key here"
REFERER = "your referer here"

searchurl = "https://www.googleapis.com/youtube/v3/videos?key=%s&id=%s&part=snippet,contentDetails"
regex = re.compile("youtube.com/watch(\?|\?.*&|\?.*&)v=([0-9a-zA-Z+-_]{11})")

info_cache = {}

def extract_time(entry):
    try:        
        dur = entry['contentDetails']['duration']
        try:
            minutes = int(dur[2:4]) * 60
        except:
            minutes = 0
        try:
            hours = int(dur[:2]) * 60 * 60
        except:
            hours = 0

        secs = int(dur[5:7])
        print hours, minutes, secs
        video.duration = hours + minutes + secs
Exemple #3
0
def uname(connection, channel, nick, cmd, args):
    if plugins.is_windows():
        p = Popen(["ver"], stdout=PIPE, shell=True).communicate()[0].strip()
    else:
        p = Popen(["uname", "-a"], stdout=PIPE).communicate()[0].strip()
    plugins.say(connection, channel, "%s: %s" % (nick, p))
Exemple #4
0
def meminfo(connection, channel, nick, cmd, args):
    if plugins.is_windows():
        minfo = meminfo_win()
    else:
        minfo = None
    plugins.say(connection, channel, "Current memory usage: %s" % minfo)