示例#1
0
def build_venue(venue_data: dict) -> Venue or False:
    """

    :param dict venue_data:
    :return:
    """

    try:
        new_venue = Venue(
            venue_data['id'],
            venue_data['displayName'],
            venue_data['city'],
            venue_data['metroArea'],
            venue_data['uri'],
            venue_data['street'],
            venue_data['zip'],
            venue_data['lat'],
            venue_data['lng'],
            venue_data['phone'],
            venue_data['website'],
            venue_data['capacity'],
            venue_data['description'])
        return new_venue

    except KeyError:
        log.info('Key not present during Venue instantiation')
        return False
示例#2
0
def build_location(location_data: dict) -> Location or False:

    try:
        new_location = Location(
            location_data['city'],
            location_data['lat'],
            location_data['lng'])
        return new_location

    except KeyError:
        log.info('Key not present during Location instantiation')
        return False
示例#3
0
def build_city(city_data: dict) -> City or False:

    try:
        new_city = City(
            city_data['id'],
            city_data['displayName'],
            str(city_data['uri']),
            city_data['country'])
        return new_city

    except KeyError:
        log.info('Key not present during City instantiation')
        return False
示例#4
0
def build_artist(artist_data: dict) -> Artist or False:

    try:
        new_artist = Artist(
            artist_data['id'],
            artist_data['displayName'],
            artist_data['uri'],
            artist_data['onTourUntil'])
        return new_artist

    except KeyError:
        log.info('Key not present during Artist instantiation')
        return False
示例#5
0
def build_performance(performance_data: dict) -> Performance or False:

    try:
        new_performance =  Performance(
            build_event_performance_artist(performance_data['artist']['displayName']),
            performance_data['displayName'],
            performance_data['billingIndex'],
            performance_data['id'],
            performance_data['billing'])
        return new_performance

    except KeyError:
        log.info('Key not present during Performance instantiation')
        return False
示例#6
0
def build_event(event_data: dict) -> Event or False:

    try:
        new_event = Event(
            event_data['id'],
            event_data['type'],
            str(event_data['uri']),
            event_data['displayName'],
            event_data['start'],
            build_event_performances(event_data['performance']),
            build_location(event_data['location']),
            build_artist_event_venue(event_data['venue']['displayName']),
            event_data['status'],
            event_data['popularity'])
        return new_event

    except KeyError:
        log.info('Key not present during Event instantiation')
        return False