Example #1
0
    def run( self ):
        global STATUS,STATUSNET
        download_url().start()
        while True:
            try:
              #			status = simplejson.load(urllib2.urlopen(STATUSNET_URL))
              #			STATUSNET = status[1]['user']['name']
                for i in range(0,3):
                    status_user = set_colors(STATUSNET_COLOR,STATUSNET_BACKGROUND_COLOR)+'StatusNet [' + str(i+1) + '/3]: ' +set_colors(STATUSNET_USER_COLOR,STATUSNET_BACKGROUND_COLOR)+' '+STATUS[i]['user']['screen_name']+set_normal_color()
                    text = STATUS[i]['text']
#                    text = text.decode('utf-8')
                    text = text.encode('iso-8859-7', 'replace')

                    from_chars = u'áâãäåæçèéêëìíîïðñóòôõö÷øùÜÝÞßúÀüýûàþÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÓÔÕÖ×ØÙ¶¸¹ºÚ¼¾Û¿'.encode('latin1')
                    to_chars =  u'abgdezh8iklmn3oprsstufxywaehiiiouuuwABGDEZH8IKLMNJOPRSTYFXCWAEHIIOUUW'.encode('latin1')
                    trantab = maketrans( from_chars, to_chars )
                    #trantab = dict((ord(a), b) for a, b in zip(from_chars, to_chars))
                    text = translate( text, trantab )
                    #text = text.translate(trantab)
                    #text = test
                    for j in range(0,len(text),20):
                        status_text = ' '+set_colors(STATUSNET_COLOR,STATUSNET_BACKGROUND_COLOR)+text[j:j+25]
                        STATUSNET =  status_user + status_text
                        sleep(3)
            except:
                sleep(3)
Example #2
0
 def run ( self ):
     global WEATHER_COND,WEATHER_SLEEP,REQ
 
     while True:
         try:
             request = Request(REQ)
             response = urlopen(request)
             the_page = response.read()
             result= search('e:.*?C',the_page)
             result_sum = search('"summary">.*?<',the_page)
             WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+result_sum.group(0)[10:len(result_sum.group(0))-2]+ result.group(0)[2:len(result.group(0))-6]+"C"+set_normal_color()
             sleep(float(WEATHER_SLEEP))
             continue
         except (URLError,AttributeError):
             WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+"n/a"+set_normal_color()
             sleep(60)
             continue
Example #3
0
 def run ( self ):
     global STATUS,STATUSNET
     while True:
         try:
             STATUS = load(urlopen("http://status.foss.ntua.gr/api/statuses/public_timeline.as?count=3"))
             sleep(60)
         except URLError:
             STATUSNET=set_colors(STATUSNET_COLOR,STATUSNET_BACKGROUND_COLOR)+"Cannot connect"+set_normal_color()
             sleep(60)
Example #4
0
 def run(self):
     global UNREAD
     while True:
         try:
             srv = IMAP4_SSL("imap.gmail.com")
             count=[]
             srv.login(GMAIL_USERNAME,GMAIL_PASSWORD)
             srv.select()
             status,count=srv.search(None,'UnSeen')
             #unseen= len(c.get_inbox_conversations(is_unread=True))
             UNREAD=set_colors(GMAIL_UNREAD_COLOR,GMAIL_BACKGROUND_COLOR)+str(len(count[0][1:].split()))+set_colors(GMAIL_COLOR,GMAIL_BACKGROUND_COLOR)+" ^i("+ICON_PATH+"/envelope.xbm)"+set_normal_color()
             srv.close()
             srv.logout()
             sleep(60)
         except:
             sleep(60)
Example #5
0
    if len(sys.argv) < 2:
        help.usage()
        sys.exit(1)

    profile = sys.argv[2:] or []
    if len(profile) == 2 and profile[0] == '-f':
        profile.load_profile_from_file(profile[1])

    curses.initscr()
    curses.start_color()

    curses.cbreak()
    curses.noecho()
    curses.curs_set(0)

    colors.set_colors()

    threads = threading.Thread(target=ingest_from_file, args=(sys.argv[1], ))
    # x = threading.Thread(target=ingest_from_stdin)
    threads.start()

    try:
        wrapper(main)
    except KeyboardInterrupt:
        # Let the other thread exist also
        globvar.quitting = True

    # Wait for the ingestor thread
    threads.join()

    curses.endwin()
Example #6
0
from time import sleep
from threading import Thread
from config_mod import GMAIL_BACKGROUND_COLOR,GMAIL_COLOR,GMAIL_UNREAD_COLOR,GMAIL_USERNAME,GMAIL_PASSWORD,ICON_PATH
from colors import set_colors,set_normal_color
from imaplib import IMAP4_SSL
UNREAD=set_colors(GMAIL_UNREAD_COLOR,GMAIL_BACKGROUND_COLOR)+"n/a"+set_colors(GMAIL_COLOR,GMAIL_BACKGROUND_COLOR)+" ^i("+ICON_PATH+"/envelope.xbm)"+set_normal_color()
def unread():
    return UNREAD
class get_gmail_check(Thread):
    def run(self):
        global UNREAD
        while True:
            try:
                srv = IMAP4_SSL("imap.gmail.com")
                count=[]
                srv.login(GMAIL_USERNAME,GMAIL_PASSWORD)
                srv.select()
                status,count=srv.search(None,'UnSeen')
                #unseen= len(c.get_inbox_conversations(is_unread=True))
                UNREAD=set_colors(GMAIL_UNREAD_COLOR,GMAIL_BACKGROUND_COLOR)+str(len(count[0][1:].split()))+set_colors(GMAIL_COLOR,GMAIL_BACKGROUND_COLOR)+" ^i("+ICON_PATH+"/envelope.xbm)"+set_normal_color()
                srv.close()
                srv.logout()
                sleep(60)
            except:
                sleep(60)

Example #7
0
from time import sleep
from threading import Thread
from re import search
from urllib2 import Request, urlopen, URLError
from config_mod import WEATHER_BACKGROUND_COLOR, WEATHER_COLOR, WEATHER_SLEEP, REQ
from colors import set_colors,set_normal_color
WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+"n/a"+set_normal_color()

def weather_cond():
    return WEATHER_COND
class get_weather(Thread):
    def run ( self ):
        global WEATHER_COND,WEATHER_SLEEP,REQ
    
        while True:
            try:
                request = Request(REQ)
                response = urlopen(request)
                the_page = response.read()
                result= search('e:.*?C',the_page)
                result_sum = search('"summary">.*?<',the_page)
                WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+result_sum.group(0)[10:len(result_sum.group(0))-2]+ result.group(0)[2:len(result.group(0))-6]+"C"+set_normal_color()
                sleep(float(WEATHER_SLEEP))
                continue
            except (URLError,AttributeError):
                WEATHER_COND=set_colors(WEATHER_COLOR,WEATHER_BACKGROUND_COLOR)+"n/a"+set_normal_color()
                sleep(60)
                continue
Example #8
0
def NOW():
    return set_colors(TIME_COLOR, TIME_BACKGROUND_COLOR) + strftime("%d-%m %H:%M") + set_normal_color()