コード例 #1
0
	def post(self):
		received_data = self.request
		line_no = 1	
		boundary = received_data.headers["Content-Type"].split(";")[1].replace("boundary=","")
		name_pos = received_data.body.find('name="text"\r\n\r\n')+15
		end_data_pos = received_data.body[name_pos:].find("\r\n")+name_pos
		entered_text = received_data.body[name_pos:end_data_pos]

		line_no_pos = received_data.body.find('name="line_no"')+18
		line_no_end_pos = received_data.body[line_no_pos:].find("\r\n")+line_no_pos
		line_no = received_data.body[line_no_pos:line_no_end_pos]
		
		
		db=MySQLdb.connect(passwd="csndoidar",db="radiodns_client",user="******",use_unicode=True,charset="utf8",host=DB_SERVER,port=3306)		
		c = db.cursor()
		if AIRTIME_SELECTED == 1:
			airtime = airtime_data.airtime()
			playlist_data=airtime.get_data()
			start_time = playlist_data[int(line_no)][0]
			end_time = playlist_data[int(line_no)][3]
		
		ret = dbGetTimes(start_time,end_time)
		list_of_ids =[]
		for i in ret:
			list_of_ids.append(i[3])
		if len(list_of_ids)>0:
			last_id = max(list_of_ids)+1
		else:
			last_id = 1
		c.execute("insert into radiodns_client.radiodns_client (radio_station,text_field,start_time,end_time,datetime_id) values (%s,%s,%s,%s,%s,%s)",("www.val202.si",entered_text,start_time,end_time,str(last_id)))
		
		
		self.render("templates/uptext.html",received_data = received_data.body[name_pos:end_data_pos])	
コード例 #2
0
	def get(self,data):
		line_no = data.split("/")[1]
		if AIRTIME_SELECTED == 1:
			airtime = airtime_data.airtime()
			playlist_data=airtime.get_data()
			description = playlist_data[int(line_no)][2]
		
		self.render("templates/upload_data.html",line_no = line_no, image_list_url=image_list_url)					
コード例 #3
0
	def get(self,data):
		airtime = airtime_data.airtime()
		playlist_data=airtime.get_data()
		start_time = playlist_data[int(data.split("/")[1])][0]
		end_time = playlist_data[int(data.split("/")[1])][3]
		outdata = dbGetTimes(start_time,end_time)

		self.render("templates/getmysqldbdata.html",data = outdata)			
コード例 #4
0
	def get(self,indata):
		playlist_data=[]
		if AIRTIME_SELECTED == 1:
			airtime = airtime_data.airtime()
			playlist_data=airtime.get_data()
			start_time = playlist_data[int(line_no)][0]
			end_time = playlist_data[int(line_no)][3]
		self.set_header("Content-Type","text/xml")		
		self.write(xml_data)
コード例 #5
0
	def post(self):
		received_data = self.request	
		line_no = 1	
		boundary = received_data.headers["Content-Type"].split(";")[1].replace("boundary=","")
		content_type_pos = received_data.body.find("Content-Type:")
		end_header_pos = received_data.body[content_type_pos:].find("\r\n")+content_type_pos
		file_data = received_data.body[end_header_pos:].replace(boundary,"")
		file_name_pos = received_data.body.find("filename") 
		file_name_end_pos = received_data.body[file_name_pos:].replace('filename="','').find('"')+file_name_pos
		file_name = received_data.body[file_name_pos+10:file_name_end_pos+10]

		name_pos = received_data.body.find('name="text"\r\n\r\n')+15
		end_data_pos = received_data.body[name_pos:].find("\r\n")+name_pos
		entered_text = received_data.body[name_pos:end_data_pos]

		
		line_no_pos = received_data.body[end_header_pos:].find('name="line_no"')+end_header_pos+18
		line_no_end_pos = received_data.body[line_no_pos:].find("\r\n")+line_no_pos
		line_no = received_data.body[line_no_pos:line_no_end_pos]
		
		fopen = open("static/music/"+file_name,"wb")
		fopen.write(file_data)
		fopen.close()
		db=MySQLdb.connect(passwd="csndoidar",db="radiodns_client",user="******",use_unicode=True,charset="utf8",host=DB_SERVER,port=3306)		
		c = db.cursor()
		if AIRTIME_SELECTED == 1:
			airtime = airtime_data.airtime()
			playlist_data=airtime.get_data()
			start_time = playlist_data[int(line_no)][0]
			end_time = playlist_data[int(line_no)][3]
			description = playlist_data[int(line_no)][2]
		
		ret = dbGetTimes(start_time,end_time)
		list_of_ids =[]
		for i in ret:
			list_of_ids.append(i[3])
		if len(list_of_ids)>0:
			last_id = max(list_of_ids)+1
		else:
			last_id = 1
		c.execute("insert into radiodns_client.radiodns_client (radio_station,url_field,text_field,start_time,end_time,datetime_id) values (%s,%s,%s,%s,%s,%s)",("www.val202.si",file_name,entered_text,start_time,end_time,str(last_id)))
		self.redirect("/setting")		
コード例 #6
0
ファイル: epg_generate.py プロジェクト: Airtime/RadioVIS_EPG
	def __init__(self):
		if AIRTIME_SELECTED == 1:
			airtime = airtime_data.airtime()
			self.playlist_data=airtime.get_data()
コード例 #7
0
	def get(self):
		airtime = airtime_data.airtime()
		playlist_data=airtime.get_data()
		cnt = len(playlist_data)
		self.render("templates/settings.html", title="Settings", outdata = playlist_data, cnt = cnt)