def main():
    result = {}
    for config in guide_config.GUIDES:
        result[config.city_name_url_token] = guide_data = []
        for trip_plan in data.load_trip_plans_by_ids(config.trip_plan_ids):
            guide_data.append({
                'id': trip_plan.trip_plan_id,
                'name': trip_plan.name,
                'cover_image_url': trip_plan.cover_image_url,
                'source_url': trip_plan.source_url,
                'description': trip_plan.description,
                'num_entities': len(trip_plan.entities or []),
                'content_date': trip_plan.content_date,
                })
    print json.dumps(result, sort_keys=True, indent=4, separators=(',', ': '))
def load_trip_plans(mode):
    if not mode or mode == 'all':
        db_user = user.User.get_by_email(GUIDE_USER)
        return data.load_all_trip_plans_for_creator(db_user.id)
    elif mode in ('urls', 'ids'):
        trip_plan_ids = []
        for row in csv.reader(fileinput.input()):
            id_or_url = row[0]
            try:
                if mode == 'urls':
                    trip_plan_id = int(id_or_url.split('/')[-1])
                else:
                    trip_plan_id = int(id_or_url)
            except:
                continue
            trip_plan_ids.append(trip_plan_id)
        return data.load_trip_plans_by_ids(trip_plan_ids)
    return None