def callback(ch, method, properties, body): print " [x] Received %r" % body m = json.loads(body) cfg = loadconfig() if m['action'] == "greenscreen": greenscreen(cfg, m['filename']) if m['action'] == "build_1_up": fn = build_1_up(cfg, m['files']) if cfg['send_to_printer'] == "True": print_photo(fn) if m['action'] == "fb_upload": fb_upload(cfg, m['filename']) ch.basic_ack(delivery_tag=method.delivery_tag)
def callback(ch, method, properties, body): print " [x] Received %r" % body m = json.loads(body) cfg = loadconfig() if m['action'] == "greenscreen": greenscreen(cfg, m['filename']) if m['action'] == "build_1_up": fn = build_1_up(cfg,m['files']) if cfg['send_to_printer'] == "True": print_photo(fn) if m['action'] == "fb_upload": fb_upload(cfg, m['filename']) ch.basic_ack(delivery_tag = method.delivery_tag)
# Make sure directories exist if not os.path.isdir(TMPDIR): os.mkdir(TMPDIR) if not os.path.isdir(EV_DIR): os.mkdir(EV_DIR) if not os.path.isdir(EV_ORIG_DIR): os.mkdir(EV_ORIG_DIR) if not os.path.isdir(EV_MARKED_DIR): os.mkdir(EV_MARKED_DIR) if not os.path.isdir(EV_FINAL_DIR): os.mkdir(EV_FINAL_DIR) if not os.path.isdir(EV_PROC_DIR): os.mkdir(EV_PROC_DIR) loadconfig() # Connect to Arduino s = serial.Serial('/dev/ttyACM0'); # Node.js connection sio = SocketIO() sio.send("log_event", "PhotoPops.py started") lastheartbeat = time.time() # For storing the filenames of a multiple-shot set. photo_list = list() def download_photo(): ''' Download photo from camera with gphoto2. Delete photo from camera immediately. Return filename. ''' print "Downloading photo...",