def getInfo(data, origin, num):
	x=len(data)
	#if data["errors"]:
	#	print ("Oh no, there was an error" + data["errors"])
	
	if x>0 :
		for i in range (x):
			lat = data[i]["venue"]["latitude"]
			lon =data[i]["venue"]["longitude"]
			times=GoogleDirections.getDirections(origin, str(lat)+","+str(lon))
			venAddress=GoogleDirections.geoCode(str(lat)+","+str(lon), "address")
			printData(data, i, times, num+i, venAddress)
	else:
		print ("No Events Available")
def getInfo(data, origin):
	x=len(data["events"])
	if x>0:
		for i in range (x):
			venue_id=data["events"][i]["venue_id"]
			category_id=data["events"][i]["category_id"]
			catName=getCategoryInfo(category_id)
			venInfo=getVenueInfo(venue_id)
			venName=venInfo[0]
			venCoords=venInfo[1]
			venAdd=venInfo[2]
			drivingtime=GoogleDirections.getDirections(origin, venCoords)
			startdate=data["events"][i]["start"]["local"].split('T')
			enddate=data["events"][i]["end"]["local"].split('T')
			print ()
			print(str(i+1) +" : "+data["events"][i]["name"]["text"])
			print("Venue  : "+venName)
			print("Address : "+venAdd)
			print("Start Date : "+startdate[0])
			print("Start Time : "+startdate[1])
			if startdate[0]!=enddate[0]:
				print("End Date : "+enddate[0])
			print("End Time : "+enddate[1])
			print("Driving Time : "+drivingtime[0])
			print ("Biking Time : "+drivingtime[1])
			print ("Comparison Time :"+str(drivingtime[2])+"mins")
			print("Link : "+data["events"][i]["url"])
	else:
		print ("There are no events available")
	date2=date+datetime.timedelta(days=x)
	bandTimeFrame = str(date)+","+str(date2)
	return bandTimeFrame
	
if timeframe == "today":
	bandTimeFrame=getDate(0)
elif timeframe == "tomorrow":
	bandTimeFrame=getDate(1)
elif timeframe == "this week":
	day=date.isoweekday()
	timeframe="this_week"
	bandTimeFrame=getDate(7-day)
else:
	print ("Bad time request")
	quit()
latlon=GoogleDirections.geoCode(origin, "coords")
if latlon==None:
	exit()
else:
	lat=latlon[0]
	lon=latlon[1]
	origin=str(lat)+','+str(lon)


url = 'www.eventbriteapi.com'	
connection = http.client.HTTPSConnection(url)
( status, body ) = http_call( "GET", connection, "/v3/events/search/", {"location.address":origin,"location.within":str(distance)+"mi", "start_date.keyword":timeframe,"sort_by":"date","token":"6YDDAPKWBOWBGAGGSFNW"})
data=json.loads(body)

url = 'api.bandsintown.com'	
connection = http.client.HTTPConnection(url)
Example #4
0
import FOVCalc, TreeDB, GoogleDirections, StreetviewImages, haversine, TrunkRecognition

coordinates = TreeDB.getCoordinates()
for i in range(0,10):

	imageCoords = GoogleDirections.getImageCoordinates(coordinates[i])
	distance = haversine.distance(coordinates[i], imageCoords)
	bearing = haversine.initialBearing(imageCoords,coordinates[i])
	image = StreetviewImages.getImage(imageCoords,bearing,-15)
	# trunkWidth = TrunkRecognition.getWidthOfTrunk(image)
	# diameter = FOVCalc.calculateWidth(trunkWidth,600,30,distance)
	# print(diameter)