Ejemplo n.º 1
0
def gen_many_artists(num_artists=10,
                     name_prefix="artist_",
                     city="San Francisco",
                     state="CA",
                     genre="Other"):
    artists = []
    for i in range(1, num_artists):
        new_artist = Artist()
        new_artist.name = f'{name_prefix}{i}'
        new_artist.genre.append(ArtistGenre(name=genre))
        new_artist.city = city
        new_artist.state = state
        new_artist.phone = "555-555-5555"
        new_artist.website = "https://www.{name_prefix}{i}.com"
        new_artist.facebook_link = "https://www.facebook.com/{name_prefix}{i}"
        new_artist.seeking_venue = False
        new_artist.image_link = "https://images.unsplash.com/photo-1549213783-8284d0336c4f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=300&q=80"
        new_artist.listed_time = datetime.datetime.utcnow()
        artists.append(new_artist)

    db.session.add_all(artists)
    db.session.commit()
Ejemplo n.º 2
0
def gen_specific_data():
    artist0 = Artist()
    artist0.name = "Guns N Petals"
    artist0.genre.append(ArtistGenre(name="Rock N Roll"))
    artist0.city = "San Francisco"
    artist0.state = "CA"
    artist0.phone = "326-123-5000"
    artist0.website = "https://www.gunspetalsband.com"
    artist0.facebook_link = "https://www.facebook.com/GunsNPetals"
    artist0.seeking_venue = True
    artist0.seeking_description = "Looking for shows to perform at in the San Francisco Bay Area!"
    artist0.image_link = "https://images.unsplash.com/photo-1549213783-8284d0336c4f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=300&q=80"
    artist0.listed_time = datetime.datetime.utcnow()

    artist1 = Artist()
    artist1.name = "Matt Quevedo"
    artist1.genre.append(ArtistGenre(name="Jazz"))
    artist1.city = "New York"
    artist1.state = "NY"
    artist1.phone = "300-400-5000"
    artist1.facebook_link = "https://www.facebook.com/mattquevedo923251523"
    artist1.seeking_venue = False
    artist1.image_link = "https://images.unsplash.com/photo-1495223153807-b916f75de8c5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80"
    artist1.listed_time = datetime.datetime.utcnow()

    artist2 = Artist()
    artist2.name = "The Wild Sax Band"
    artist2.genre.append(ArtistGenre(name="Jazz"))
    artist2.genre.append(ArtistGenre(name="Classical"))
    artist2.city = "San Francisco"
    artist2.state = "CA"
    artist2.phone = "432-325-5432"
    artist2.seeking_venue = False
    artist2.image_link = "https://images.unsplash.com/photo-1558369981-f9ca78462e61?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=794&q=80"
    artist2.listed_time = datetime.datetime.utcnow()

    artist3 = Artist()
    artist3.name = "Mo Jo Yo Jo"
    artist3.genre.append(ArtistGenre(name="Hip Hop Anonymous"))
    artist3.city = "Cool Cats"
    artist3.state = "CA"
    artist3.phone = "555-555-5000"
    artist3.website = "https://www.hoptothetop.com"
    artist3.facebook_link = "https://www.facebook.com/mojoyojo"
    artist3.seeking_venue = True
    artist3.seeking_description = "Looking for shows to perform at in Cool Cats California!"
    artist3.image_link = "https://images.unsplash.com/photo-1549213783-8284d0336c4f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=300&q=80"
    artist3.listed_time = datetime.datetime.utcnow()

    db.session.add(artist0)
    db.session.add(artist1)
    db.session.add(artist2)
    db.session.add(artist3)
    db.session.commit()

    venue0 = Venue()
    venue0.city = "San Francisco"
    venue0.state = "CA"
    venue0.phone = "123-123-1234"
    venue0.name = "The Musical Hop"
    venue0.genre.append(VenueGenre(name="Rock N Roll"))
    venue0.genre.append(VenueGenre(name="Jazz"))
    venue0.genre.append(VenueGenre(name="Classical"))
    venue0.address = "1015 Folsom Street"
    venue0.seeking_talent = True
    venue0.seeking_talent_desc = "We don't need talent, we need legends"
    venue0.listed_time = datetime.datetime.utcnow()

    venue1 = Venue()
    venue1.city = "San Francisco"
    venue1.state = "CA"
    venue1.phone = "415-000-1234"
    venue1.name = "Park Square Live Music & Coffee",
    venue1.genre.append(VenueGenre(name="Rap"))
    venue1.genre.append(VenueGenre(name="Rock N Roll"))
    venue1.genre.append(VenueGenre(name="Punk"))
    venue1.address = "34 Whiskey Moore Ave"
    venue1.seeking_talent = False
    venue1.listed_time = datetime.datetime.utcnow()

    venue2 = Venue()
    venue2.city = "New York"
    venue2.state = "NY"
    venue2.phone = "914-003-1132"
    venue2.name = "The Dueling Pianos Bar"
    venue2.genre.append(VenueGenre(name="Soul"))
    venue2.address = "335 Delancey Street"
    venue2.seeking_talent = True
    venue2.seeking_talent_desc = "Yo we need some talent in this hizouse"
    venue2.listed_time = datetime.datetime.utcnow()

    venue3 = Venue()
    venue3.city = "Oakland"
    venue3.state = "CA"
    venue3.phone = "415-555-5555"
    venue3.name = "Oakland Convention Center",
    venue3.genre.append(VenueGenre(name="Alternative"))
    venue3.address = "6824 Main St"
    venue3.seeking_talent = False
    venue3.listed_time = datetime.datetime.utcnow()

    db.session.add(venue0)
    db.session.add(venue1)
    db.session.add(venue2)
    db.session.add(venue3)
    db.session.commit()

    show0 = Show()
    show0.artist_id = Artist.query.first().id
    show0.venue_id = Venue.query.first().id
    show0.start_time = datetime.datetime.fromisoformat(
        '2020-04-05T21:30:00.000')

    db.session.add(show0)
    db.session.commit()
Ejemplo n.º 3
0
from data.artists import *
from data.shows import *

db.session.query(Show).delete()
db.session.query(ArtistGenres).delete()
db.session.query(VenueGenres).delete()
db.session.query(Artist).delete()
db.session.query(Venue).delete()

for i, x in enumerate([venues, artists]):

    for obj in x:
        if i == 0:
            o = Venue()
        if i == 1:
            o = Artist()

        o.name = obj['name']
        try:
            o.address = obj['address']
        except:
            pass
        o.city = obj['city']
        o.state = obj['state']
        o.phone = obj['phone']
        o.website = obj.get('website')
        o.facebook_link = obj.get('facebook_link')
        try:
            o.seeking_talent = obj['seeking_talent']
        except:
            o.seeking_venue = obj['seeking_venue']
Ejemplo n.º 4
0
def add_initial_data():

    # Add initial Venue datapoints
    venue1 = {
        "id":
        1,
        "name":
        "The Musical Hop",
        "genres":
        "Jazz, Reggae, Swing, Classical, Folk",
        "address":
        "1015 Folsom Street",
        "city":
        "San Francisco",
        "state":
        "CA",
        "phone":
        "123-123-1234",
        "website":
        "https://www.themusicalhop.com",
        "facebook_link":
        "https://www.facebook.com/TheMusicalHop",
        "seeking_talent":
        True,
        "seeking_description":
        "We are on the lookout for a local artist to play every two weeks. Please call us.",
        "image_link":
        "https://images.unsplash.com/photo-1543900694-133f37abaaa5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=400&q=60"
    }

    venue2 = {
        "id":
        2,
        "name":
        "The Dueling Pianos Bar",
        "genres":
        "Classical, R&B, Hip-Hop",
        "address":
        "335 Delancey Street",
        "city":
        "New York",
        "state":
        "NY",
        "phone":
        "914-003-1132",
        "website":
        "https://www.theduelingpianos.com",
        "facebook_link":
        "https://www.facebook.com/theduelingpianos",
        "seeking_talent":
        False,
        "image_link":
        "https://images.unsplash.com/photo-1497032205916-ac775f0649ae?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80"
    }

    venue3 = {
        "id":
        3,
        "name":
        "Park Square Live Music & Coffee",
        "genres":
        "Rock n Roll, Jazz, Classical, Folk",
        "address":
        "34 Whiskey Moore Ave",
        "city":
        "San Francisco",
        "state":
        "CA",
        "phone":
        "415-000-1234",
        "website":
        "https://www.parksquarelivemusicandcoffee.com",
        "facebook_link":
        "https://www.facebook.com/ParkSquareLiveMusicAndCoffee",
        "seeking_talent":
        False,
        "image_link":
        "https://images.unsplash.com/photo-1485686531765-ba63b07845a7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=747&q=80"
    }

    artist1 = {
        "id":
        4,
        "name":
        "Guns N Petals",
        "genres":
        "Rock n Roll",
        "city":
        "San Francisco",
        "state":
        "CA",
        "phone":
        "326-123-5000",
        "website":
        "https://www.gunsnpetalsband.com",
        "facebook_link":
        "https://www.facebook.com/GunsNPetals",
        "seeking_venue":
        True,
        "seeking_description":
        "Looking for shows to perform at in the San Francisco Bay Area!",
        "image_link":
        "https://images.unsplash.com/photo-1549213783-8284d0336c4f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=300&q=80"
    }
    artist2 = {
        "id":
        5,
        "name":
        "Matt Quevedo",
        "genres":
        "Jazz",
        "city":
        "New York",
        "state":
        "NY",
        "phone":
        "300-400-5000",
        "facebook_link":
        "https://www.facebook.com/mattquevedo923251523",
        "seeking_venue":
        False,
        "image_link":
        "https://images.unsplash.com/photo-1495223153807-b916f75de8c5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80"
    }
    artist3 = {
        "id":
        6,
        "name":
        "The Wild Sax Band",
        "genres": ["Jazz", "Classical"],
        "city":
        "San Francisco",
        "state":
        "CA",
        "phone":
        "432-325-5432",
        "seeking_venue":
        False,
        "image_link":
        "https://images.unsplash.com/photo-1558369981-f9ca78462e61?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=794&q=80"
    }

    show_data = [{
        "venue_id": 1,
        "artist_id": 4,
        "start_time": "2019-05-21T21:30:00.000Z"
    }, {
        "venue_id": 3,
        "artist_id": 5,
        "start_time": "2019-06-15T23:00:00.000Z"
    }, {
        "venue_id": 3,
        "artist_id": 6,
        "start_time": "2035-04-01T20:00:00.000Z"
    }, {
        "venue_id": 3,
        "artist_id": 6,
        "start_time": "2035-04-08T20:00:00.000Z"
    }, {
        "venue_id": 3,
        "artist_id": 6,
        "start_time": "2035-04-15T20:00:00.000Z"
    }]

    for venue in [venue1, venue2, venue3]:
        venue_record = Venue(**venue)
        db.session.add(venue_record)

    for artist in [artist1, artist2, artist3]:
        artist_record = Artist(**artist)
        db.session.add(artist_record)

    for show in show_data:
        show_record = Show(**show)
        db.session.add(show_record)

    db.session.commit()
Ejemplo n.º 5
0
#!/usr/bin/env python

from random import randint

from app import Artist, Concert, Performance, Song, db

print("\n 🌱 seeding db... \n")

db.drop_all()
db.create_all()

artists = [Artist(name="Massive Attack"), Artist(name="Nas")]
for a in artists:
    db.session.add(a)
db.session.commit()

massive_attack = Artist.query.get(1)
nas = Artist.query.get(2)

songs = [
    Song(name="One Love", artist=massive_attack),
    Song(name="One Love", artist=nas),
    Song(name="Protection", artist=massive_attack),
    Song(name="Black Bond", artist=nas),
    Song(name="The World is Yours", artist=nas),
    Song(name="Bye Baby", artist=nas),
]
for s in songs:
    db.session.add(s)
db.session.commit()
Ejemplo n.º 6
0
    city='Coolville',
    state='CA',
    phone='666-666-6666',
    website='https://www.youtube.com/watch?v=dQw4w9WgXcQ',
    facebook_link='https://www.facebook.com/joeexotic',
    seeking_talent=False,
    seeking_description='Noice!',
    image_link='https://images.unsplash.com/photo-1543900694-133f37abaaa5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=400&q=60',
)

artist = Artist(
    name="Justin Beiberlake",
    genres=["Jazz", "Reggae", "Swing", "Classical", "Folk"],
    city='Fakesville',
    state="CA",
    phone='555-555-5556',
    website='https://www.youtube.com/watch?v=dQw4w9WgXcQ',
    facebook_link='https://www.facebook.com/joeexotic',
    image_link="https://images.unsplash.com/photo-1549213783-8284d0336c4f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=300&q=80",
    seeking_venue=True,
    seeking_description='Fake it till you make it baby!'
)

artist2 = Artist(
    name="Chris Cornelton",
    genres=["Swing", "Classical", "Folk"],
    city='Fakesville',
    state="CA",
    phone='555-555-5456',
    website='https://www.youtube.com/watch?v=dQw4w9WgXcQ',
    facebook_link='https://www.facebook.com/joeexotic',
    image_link="https://images.unsplash.com/photo-1549213783-8284d0336c4f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=300&q=80",