def sample_route():
    list = get_weather.get_weather_list()
    i = 10
    states = ''
    colors = ''
    for item in list:
        states = states + '"' + item + '",'
        colors = colors + '' + str(i) + ','
        i = i + 4
    return template("sample1",states=states,colors=colors)
예제 #2
0
def sample_route():
    list = get_weather.get_weather_list()
    i = 10
    states = ''
    colors = ''
    for item in list:
        states = states + '"' + item + '",'
        colors = colors + '' + str(i) + ','
        i = i + 4
    return template("sample", states=states, colors=colors)
예제 #3
0
def lab6():
    list = get_weather.get_weather_list()
    states = []
    reds = []
    greens = []
    blues = []
    for item in list:
        states.append(item)
        reds.append(list[item]['humidity']*2)
        greens.append(0)
        blues.append(int(list[item]['temp']-273)*5)
    return template("lab6", states = states, reds = reds, greens = greens, blues = blues)
예제 #4
0
def map_route():
    list = get_weather.get_weather_list()
    states = []
    reds = []
    greens = []
    blues = []
    for item in list:
        states.append(item)
        blues.append(list[item]['humidity']*2)
        greens.append(0)
        reds.append(int(list[item]['temp']-273)*5)
    return template("map", states = states, reds = reds, greens = greens, blues = blues)
예제 #5
0
             else:
                 subprocess.call(['aplay', 'beep.wav'])
                 if not p is None:
                     p.wait()
                     p = None
                 last_time = time.time()
                 nullf = file('/dev/null', 'w')
                 text = None
                 if data['ircode'] == OWN_WEATHER:
                     last_data = get_last_data()
                     timestamp = time.localtime(last_data['timestamp'])
                     text = 'At %d hour, %d minutes, the temperature outside is %d degrees, humidity is %d' % (
                         timestamp.tm_hour, timestamp.tm_min,
                         last_data['t'], last_data['h'])
                 elif data['ircode'] == OUTER_WEATHER:
                     text = '.\n'.join(get_weather_list('Kirrawee'))
                 if text:
                     #cmdlst = ['espeak', '-s', '150', text, '--stdout']
                     #cmd = '%s | sox -t wav - -r 44100 -t wav - | aplay -v' % subprocess.list2cmdline(cmdlst)
                     cmdlst = ['echo', text]
                     #							cmd = '%s | text2wave -f 44100 |aplay -v' % subprocess.list2cmdline(cmdlst)
                     cmd = '%s | festival --tts --pipe' % subprocess.list2cmdline(
                         cmdlst)
                     dbprint(cmd)
                     p = subprocess.Popen(cmd, shell=True)
         else:
             dbprint('Too soon')
     else:
         dbprint('Wrong code')
 except Exception, e:
     if isinstance(e, KeyboardInterrupt):