示例#1
0
def create_roundware_arguments(form):
	dform = server.form_to_dict(form)
	convert_listen_versions(dform)
	convert_comma_to_tab(dform)
	find_session_id(dform)
	dform['operation'] = get_operation(dform)
	dform['config'] = "scapes"
	dform['projectid'] = "4"
	dform['categoryid'] = "8"
	dform['subcategoryid'] = "9"
	return dform
示例#2
0
#!/usr/bin/env python

import cgi, cgitb 
from roundwared import server
import json

print "Content-type: text/plain"
print
# The following like is what should be here. However the OceanVoices client
# is still expecting a different protocol and thus the hack at the end of this
# file is in place to accomodate it.
#print server.webservice_main(server.form_to_dict(cgi.FieldStorage()))

# BEGIN HACK
val = server.catch_errors(server.form_to_dict(cgi.FieldStorage()))
if val.has_key('STREAM_URL'):
	print '"'+val['STREAM_URL']+'"';
else:
	print json.dumps(val, sort_keys=True, indent=4)
# END HACK

示例#3
0
def app(environ, start_response):
	start_response('200 OK', [('Content-Type', 'text/html')])
	form = cgi.FieldStorage(environ['wsgi.input'], environ=environ)
	return server.webservice_main(server.form_to_dict(form))
示例#4
0
form = cgi.FieldStorage() 

logging.basicConfig(
	filename=settings.config["log_file"],
	filemode="a",
	level=logging.DEBUG,
	format='%(asctime)s %(filename)s:%(lineno)d %(levelname)s %(message)s',
)

if form.getvalue('config'):
	settings.initialize_config(
		os.path.join(
			'/etc/roundware/',
			form.getvalue('config')))

dict_form = server.form_to_dict(form)
result = server.request_stream(dict_form)
url = result['STREAM_URL']
num_rec = server.number_of_recordings(dict_form)

print "Content-type: text/html"
print
print "<html><head><title>Roundware - Listen</title></head><body>"
print "<p>" + str(num_rec) + " recordings match your selection."
print "<p>You can use the <a href=\""+url+"\">MP3 url</a> or the "
print "<a href=\""+url+".m3u\">M3U url</a>."
print "<p>You can <a href=\"/cgi-bin/control.py?stream_url="+url+"\">control</a> your stream too.</p>"
print "</body></html>"