예제 #1
0
	def _set_day(self, _date, sch):
		for key in sch.keys():
			if(key == "date" or key == "mode" or key == "action"):
				continue
			print "setting - " + _date
			redis.set("scheduledItem:" + _date + ":" + key, sch[key])
		redis.save()
예제 #2
0
	def DELETE(self, name):
		#params = web.input()
		#print params
		clipName = name
		redis.delete("cue:" + clipName)
		redis.save()
		cull_playlists(name)
예제 #3
0
def cull_playlists(item):
	playlist_keys = redis.keys('playlist:*')
	for i in playlist_keys:
		playlist_name = i.split(':')[1]
		playlist = json.loads(redis.get(i))
		cull_playlist(playlist, item)
		redis.set('playlist:' + playlist_name, json.dumps(playlist))
		redis.save()
def set_voice_recording():
	play_url = request.form.get('play_url','')

	redis.set('play_url',play_url)
	redis.save()

	response = make_response(render_template("welcome.html", playfile_success_response = "Play file details saved!"))
	response.headers['Content-type'] = 'text/html'
	return response
def set_sms_response():
	autoreply = request.form.get('autoreply','')

	print autoreply
	redis.set('auto_reply',autoreply)
	redis.save()

	response = make_response(render_template("welcome.html", success_response = "SMS Auto Response saved!"))
	response.headers['Content-type'] = 'text/html'
	return response
예제 #6
0
	def POST(self):
		params = web.input()
		plist_name = params.name;
		plist_name = plist_name.lstrip()
		plist_name = plist_name.rstrip()
		plist_str = params.playlist
		plist = plist_str.split(":")
		del plist[-1]
		redis.set('playlist:' + plist_name, json.dumps(plist))
		redis.save()
예제 #7
0
def edit_playlists(old_name, new_name):
	print "fixing playlists"
	playlist_keys = redis.keys('playlist:*')
	for i in playlist_keys:
		playlist_name = i.split(':')[1]
		playlist = json.loads(redis.get(i))
		#print playlist
		edit_playlist(playlist, old_name, new_name)
		redis.set('playlist:' + playlist_name, json.dumps(playlist))
		redis.save()
예제 #8
0
	def POST(self):
		params = web.input()
		print params
		clipName = params.clipName
		ribbonCue = params.ribbonCue
		conciergeCue = params.conciergeCue
		if params.edit == 'true':
			print "Have an edited clip."
			if params.editClipName != clipName:
				print "renaming - cue:" + params.editClipName
				redis.rename("cue:" + params.editClipName, "cue:" + clipName)
				edit_playlists(params.editClipName, clipName)
				#clipName = params.editClipName
		redis.set("cue:" + clipName, ribbonCue + ':' + conciergeCue)
		redis.save()
def send_ui_reply():
	sms_id = request.form.get('sms_id')
	sms_reply = request.form.get('action')

	print "Here I am: SMS Id - %s" % sms_id

	if ((sms_reply != "") and (not sms_id.startswith("del"))):
		src = redis.hget(sms_id,'From')
		plivo_did = redis.hget(sms_id,'Plivo DID')
		redis.hset(sms_id,"Replied",'y')
		redis.save()
		send_auto_response(src, plivo_did, sms_reply, 'True')
	elif ((sms_reply != "") and (sms_reply == "del")):
		redis.delete(sms_id[4:])
		redis.save()
	return "OK"
def set_email_config():
	from_email = request.form.get('from_email','')
	mailgun_token = request.form.get('mailgun_token','')
	to_email = request.form.get('to_email','')	
	mail_subject = request.form.get('mail_subject','')
	domain = request.form.get('domain','')

	redis.set('from_email',from_email)
	redis.set('mailgun_token',mailgun_token)
	redis.set('to_email',to_email)
	redis.set('mail_subject',mail_subject)
	redis.set('domain',domain)
	redis.save()

	response = make_response(render_template("welcome.html", email_success_response = "Email details saved!"))
	response.headers['Content-type'] = 'text/html'
	return response
def accept_and_reply():
	text = request.form.get('Text','')
	src = request.form.get('From','')
	plivo_did = request.form.get('To','')

	time_sms_received = time.asctime(time.localtime(time.time()))
	sms_key = "sms_%s" % uuid.uuid4()
	
	redis.hset(sms_key,"From", src)
	redis.hset(sms_key,"Plivo DID", plivo_did)
	redis.hset(sms_key,"Text", text)
	redis.hset(sms_key,"Time Received", time_sms_received)
	redis.hset(sms_key,"Replied",'n')
	redis.save()

	send_auto_response(src,plivo_did,text)

	email_SMS(text,src,plivo_did)

	response = make_response("OK")
	response.headers['Content-type'] = 'text/html'
	return response
예제 #12
0
	def DELETE(self, plist):
		redis.delete("playlist:" + plist)
		redis.save()
		cull_scheduler(plist)
예제 #13
0
	def GET(self):
		playlist_keys = redis.keys('playlist:*')
		for i in playlist_keys:
			redis.delete(i)
		redis.save()
예제 #14
0
	def _clear_day(self, _date):
		#print "clearing " + _date
		keys = redis.keys('scheduledItem:' + _date + ':*')
		for i in keys:
			redis.delete(i)
		redis.save()
예제 #15
0
	def POST(self):
		params = web.input()
		playlist = params.plist
		print "setting " + playlist + " to default"
		redis.set('defaultPlaylist', playlist)
		redis.save()
예제 #16
0
        'all_data_hash': all_data_hash,
        'usage_datasets': usage_datasets
    }

    logger.info(
        f'Total CPU: {total_cpu_usage_us}, Total NET: {total_net_usage_words}, Totals Hash: {total_usage_hash}, All Data hash: {all_data_hash}'
    )

    # add to SUBMISSION_DATA
    p = redis.pipeline()
    p.set('SUBMISSION_DATA_' + str(period_start), json.dumps(data))
    p.execute()


logger.info('RUNNING USING TEST USAGE DATA!')

# check no existing redis db and initialise
if os.path.exists('/data/dump.rdb'):
    logger.error(
        'Cannot continue with testing. Please clear redis data and restart.')
    KEEP_RUNNING = False

period_start_seconds, DATA_PERIOD_SECONDS, DATASET_BATCH_SIZE, _ = get_contract_configuration_state(
)
redis.set('DATA_PERIOD_SECONDS', DATA_PERIOD_SECONDS)
redis.set('DATASET_BATCH_SIZE', DATASET_BATCH_SIZE)
redis.save()

for period in range(TEST_USAGE_DATA_PERIODS):
    aggregate_period_test_data(
        int(period_start_seconds) + (period * DATA_PERIOD_SECONDS))
예제 #17
0
def signal_handler(signal, frame):
    redis.save()
    sys.exit(0)
예제 #18
0
def clear_date(date):
	date_keys = redis.keys('scheduledItem:' + date + ":*")
	for key in date_keys:
		redis.delete(key)
	redis.save()
예제 #19
0
def signal_handler(signal, frame):
    redis.save()
    sys.exit(0)
예제 #20
0
	def GET(self):
		cue_keys = redis.keys('cue:*')
		for i in cue_keys:
			redis.delete(i)
		redis.save()