コード例 #1
0
ファイル: app.py プロジェクト: ekulrabnud/UCSports4
def save():
	
		try:
			for id,row in request.form.iterlists():
				
				if id != 'delete':
				
					row[1] = th.convert_time_string(row[1])
					#adds id to end of row list
					row.append(id)
					print row
					
					g.db.execute('''UPDATE liveSports SET event=?,startTime=?
					WHERE listingID = ?''',row)

			deletions = [(int(i),) for i in request.form.getlist('delete')]
			g.db.executemany('''DELETE from liveSports where listingID = ?''',deletions)
			g.db.connection.commit()
		
			sportslist = utils.get_live_sports(DATETODAY,START,STOP,g.db)
			response = render_template('LiveSports/liveSportsTable.html',sportslist=sportslist)
			return jsonify(html=response,error=0,message="Live Sports Updated");

		except sqlite3.Error,e:

			return jsonify(error=1,message="Error!! %s" % e.args[0]) 
コード例 #2
0
ファイル: app.py プロジェクト: ekulrabnud/UCSports4
def liveSports():

	if request.method == 'GET':
		print 'GETTING SPORTS ' + DATETODAY,START,STOP
		sportslist = utils.get_live_sports(DATETODAY,START,STOP,g.db)
	
		return render_template('LiveSports/liveSports.html',sportslist=sportslist)

	#submit new date time range for query
	elif request.method == 'POST':
		
		date = th.convert_date_string(request.form['date'])
		start = th.convert_time_string(request.form['start'])
		stop = th.convert_time_string(request.form['stop']) 
		# sportslist = utils.getLiveSports(DATETODAY,START,STOP,g.db)
		sportslist = utils.get_live_sports(date,start,stop,g.db)

		
		return render_template('LiveSports/liveSportsTable.html',sportslist=sportslist,request=request)
コード例 #3
0
ファイル: app.py プロジェクト: ekulrabnud/UCSports4
def email():

	if request.method == 'GET':

		sportslist = get_live_sports(DATETODAY,START,STOP)
	else:

		date = th.convert_date_string(request.form['date'])
		start = th.convert_time_string(request.form['start'])
		stop = th.convert_time_string(request.form['stop']) 

		sportslist = utils.get_live_sports(date,start,stop,g.db)

	return render_template('LiveSports/email.html',sportslist=sportslist,date=request.form['date'])
コード例 #4
0
ファイル: app.py プロジェクト: ekulrabnud/UCSports4
def reloadSports():

	print "reload sports"

	try: 
		print "trying"
		utils.get_lineup_listings(START,STOP,DATETODAY,config.LINEUPS,g.db)

		sportslist = utils.get_live_sports(DATETODAY,START,STOP,g.db)
	
		print sportslist
		return render_template('LiveSports/liveSportsTable.html',sportslist=sportslist)
	except Exception as e:
		print e.args
		return jsonify(error=1,message="Reload failed!!! %s" % e.args[0])
コード例 #5
0
ファイル: app.py プロジェクト: ekulrabnud/UCSports4
def add():
	print "adding new event"
	try:
		r = request.form
		import random
		listingID = random.randint(1,100)
		date = th.date_today()
		time = th.convert_time_string(r['time'])
		row = [date,time,r['event'],r['sport'],r['stationID'],listingID]
		g.db.execute('''INSERT INTO liveSports (date,startTime,event,sport,stationID,listingID)
						VALUES (?,?,?,?,?,?)''',row)

		g.db.connection.commit()

		sportslist = utils.get_live_sports(DATETODAY,START,STOP,g.db)
		response = render_template('LiveSports/liveSportsTable.html',sportslist=sportslist)
		return jsonify(html=response,error=0,message="Event Added");

	except Exception as e:

		print "Error" + e.args[0]
		# return jsonify(error=1,message="Publish Infocast failed!!!: %s" % e.args[0])
		return e.args[0]
コード例 #6
0
ファイル: app.py プロジェクト: ekulrabnud/UCSports4
def edit():

	sportslist = utils.get_live_sports(DATETODAY,START,STOP,g.db)
	print len(sportslist)
	return render_template('LiveSports/liveSportsEdit.html',sportslist=sportslist)