def main(api_key): # Set up gmaps object with API key gmaps = googlemaps.Client(key=api_key) ## Get global variables start_string = 'The Anchor, 34 Park St, Southwark, London SE1 9EF' end_string = 'Southwark Brewing Company' n_places = 2 radius_factor = 1 keywords = ['bar','beer'] mode="bicycling" ## Get location info on start and end points start = get_lat_lng(gmaps,start_string) end = get_lat_lng(gmaps,end_string) print start_string , start print end_string , end ##Find centre and radius c_cen = get_centre_lat_long(start,end) print "centre coord", c_cen # You may prefer to use the text_search API, instead. radius = haversine(c_cen['lat'],c_cen['lng'],start['lat'],start['lng'])*1000 print "radius metres", radius ##Get nearby places nearby = gmaps.places_radar( (c_cen['lat'], c_cen['lng']), radius=radius*radius_factor, keyword=keywords ) ###get info lists place_ids = map(lambda x: x['place_id'],nearby['results']) place_info = map(lambda x: gmaps.place(x),place_ids) place_names = map(lambda x: x['result']['formatted_address'],place_info)
def __init__(self, config): """ TODO: - Rearrange the Teams info. (make one function instead of two) - Add Delay option to match the TV broadcast - Add Playoff data info. - Add Powerplay info - Make a Shootout layout with check boxes for each attempt :param config: """ # Get lat/long and message (for debug) for dimmer and weather self.latlng, self.latlng_msg = get_lat_lng(config.location) # Test for alerts #self.latlng = [32.653,-83.7596] # Flag for if pushbutton has triggered self.pb_trigger = False # For pb state, reboot or poweroff self.pb_state = None # Currently displayed board self.curr_board = None self.prev_board = None # Environment Canada manager (to share between the forecast, alerts and current obs) self.ecData = None # Weather Board Info self.wx_updated = False self.wx_units = [] self.wx_current = [] self.wx_curr_wind = [] self.wx_curr_precip = [] # Weather Alert Info self.wx_alerts = [] self.wx_alert_interrupt = False #Weather Forecast Info self.forecast_updated = False self.wx_forecast = [] # For update checker, True means new update available from github self.newUpdate = False self.UpdateRepo = "riffnshred/nhl-led-scoreboard" #For screensaver self.screensaver = False self.screensaver_displayed = False self.screensaver_livegame = False # Flag to determine when to refresh data self.needs_refresh = True # Flag for network issues self.network_issues = False # Get the teams info self.teams = self.get_teams() # Save the parsed config self.config = config # Initialize the time stamp. The time stamp is found only in the live feed endpoint of a game in the API # It shows the last time (UTC) the data was updated. EX 20200114_041103 self.time_stamp = "00000000_000000" # Flag for when the data live feed of a game has updated self.new_data = True # Get each team's data from the teams info self.get_teams_info() # Get the status from the API self.get_status() # Get favorite team's id self.pref_teams = self.get_pref_teams_id() # Parse today's date and see if we should use today or yesterday self.refresh_current_date() # Set the pointer to the first game in the list of Pref Games #self.current_game_index = 0 # Fetch the games for today self.refresh_games() # Flag to indicate if all preferred games are Final self.all_pref_games_final = False # Today's date self.today = self.date() # Get refresh standings self.refresh_standings() # Playoff Flag self.isPlayoff = False # Stanley cup round flag self.stanleycup_round = False # Fetch the playoff data self.refresh_playoff() # Stanley cup champions self.ScChampions_id = self.check_stanley_cup_champion()
def __init__(self, config): """ TODO: - Rearrange the Teams info. (make one function instead of two) - Add Delay option to match the TV broadcast - Add Playoff data info. - Add Powerplay info - Make a Shootout layout with check boxes for each attempt :param config: """ # Get lat/long for dimmer and weather self.latlng = get_lat_lng(config.location) # Test for alerts #self.latlng = [49.8955367, -97.1384584] # Flag for if pushbutton has triggered self.pb_trigger = False # For pb state, reboot or poweroff self.pb_state = None # Currently displayed board self.curr_board = None # Weather Board Info self.wx_updated = False self.wx_units = [] self.wx_current = [] self.wx_curr_wind = [] self.wx_curr_precip = [] # Weather Alert Info self.wx_alerts = [] self.wx_alert_interrupt = False # For update checker, True means new update available from github self.newUpdate = False # Flag to determine when to refresh data self.needs_refresh = True # Flag for network issues self.network_issues = False # Get the teams info self.teams = self.get_teams() # Save the parsed config self.config = config # Initialize the time stamp. The time stamp is found only in the live feed endpoint of a game in the API # It shows the last time (UTC) the data was updated. EX 20200114_041103 self.time_stamp = "00000000_000000" # Flag for when the data live feed of a game has updated self.new_data = True # Get each team's data from the teams info self.get_teams_info() # Get favorite team's id self.pref_teams = self.get_pref_teams_id() # Parse today's date and see if we should use today or yesterday self.refresh_current_date() # Set the pointer to the first game in the list of Pref Games self.current_game_index = 0 # Fetch the games for today self.refresh_games() # Flag to indicate if all preferred games are Final self.all_pref_games_final = False # Today's date self.today = self.date() # Get the status from the API self.get_status() # Get refresh standings self.refresh_standings() # Get Covid 19 Data self.covid19 = covid19_data()
def __init__(self, config): # Get lat/long for dimmer and weather self.latlng = get_lat_lng(config.location) # Test for alerts #self.latlng = [32.653,-83.7596] # Flag for if pushbutton has triggered self.pb_trigger = False # For pb state, reboot or poweroff self.pb_state = None # Currently displayed board self.curr_board = None # Weather Board Info self.wx_updated = False self.wx_units = [] self.wx_current = [] self.wx_curr_wind = [] self.wx_curr_precip = [] # Weather Alert Info self.wx_alerts = [] self.wx_alert_interrupt = False # For update checker, True means new update available from github self.newUpdate = False self.UpdateRepo = "riffnshred/nhl-led-scoreboard" # Flag to determine when to refresh data self.needs_refresh = True # Flag for network issues self.network_issues = False # Get the teams info self.teams = self.get_teams() # Save the parsed config self.config = config # Initialize the time stamp. The time stamp is found only in the live feed endpoint of a game in the API # It shows the last time (UTC) the data was updated. EX 20200114_041103 self.time_stamp = "00000000_000000" # Flag for when the data live feed of a game has updated self.new_data = True # Parse today's date and see if we should use today or yesterday self.refresh_current_date() # Set the pointer to the first game in the list of Pref Games self.current_game_index = 0 # Flag to indicate if all preferred games are Final self.all_pref_games_final = False # Today's date self.today = self.date() # Get the status from the API self.get_status() # Get Covid 19 Data self.covid19 = covid19_data() self.cta_trains = traintracker()