def main():
  vp_data = []
  with open(os.path.join(os.path.dirname(__file__), 'viewpoint_data.txt'), 'r') as f:
    vp_data = json.load(f)
    vp_data = [vp for vp in vp_data if 'placemark' in vp]
    for index in xrange(len(vp_data)):
      vp = vp_data[index]
      vp['index'] = index
      vp['timestamp'] = index * event_height
      vp['datetime'] = datetime.fromtimestamp(vp['timestamp'])

  max_date = vp_data[0]['datetime']
  min_date = vp_data[-1]['datetime']
  vf_time = VFTime(vp_data[0]['timestamp'], vp_data[-1]['timestamp'])

  # Rates encompass: X years, 12 months, 28-31 days, 24 hours.
  levels = ['hours', 'days', 'months', 'years']
  level = levels[-1]
  display_places = False

  while True:
    ClearSurface()
    ProcessMotion(vf_time)
    if not vf_time.IsActive():
      DrawTargetBoxes()
    else:
      label = vf_time.GetDatetime().strftime('%b %d %Y')
      DrawGuides(vf_time)

      # Get list of viewpoints with place information between min-max dates.
      interval = vf_time.GetInterval()
      start = interval[0] - (interval[1] - interval[0]) / 2
      end = interval[1] + (interval[1] - interval[0]) / 2
      places = [vp for vp in vp_data if vp['timestamp'] > start and vp['timestamp'] < end]
      if vf_time.GetPos()[0] < 500:
        display_places = True
      if display_places:
        RenderEvents(vf_time, vp_data)

    pygame.display.flip()
dataset/ETHPy150Open viewfinderco/viewfinder/clients/experimental/viewfinder.py/main/original