Esempio n. 1
0
 def upload(self, t, filename):      
     log.info("upload %s" % filename)          
     try:
         s3.upload(filename)
         log.info("--> uploaded. Pinging server...")
         data = {'t': t}
         response = net.read("http://%s:%s" % (config['server']['host'], config['server']['port']), json.dumps(data).encode('utf-8'))
         log.info(response)
         os.remove(filename)
     except Exception as e:
         log.error(log.exc(e))
Esempio n. 2
0
#!/usr/bin/env python

import time, subprocess, os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from housepy import config, log, s3, osc

log.info("Starting recording...")
filename = "%s.wav" % int(time.time())
record_sender = osc.Sender(5280)
record_sender.send('/record', filename)

log.info("Triggering playback...")
subprocess.call("/usr/local/bin/python3 play.py live", shell=True)

DURATION = 75
time.sleep(DURATION)

log.info("Uploading...")

if s3.upload(filename):
    log.info("Removing file...")
    os.remove(filename)
Esempio n. 3
0
"""

import time, os
from housepy import config, log, net, s3

ENDPOINT = "http://appservices.citibikenyc.com/data2/stations.php"

filename = "%s.txt" % str(time.time()).split('.')[0]

log.info("----- grab attempt")

try:
    net.grab(ENDPOINT, filename)
except Exception as e:
    log.error(log.exc(e))
    exit()

log.info("got %s, pushing..." % filename)    

try:
    s3.upload(filename)
except Exception as e:
    log.error(log.exc(e))
    exit()

log.info("upload complete")

os.remove(filename)