diff --git a/backend/seed_new_bands.py b/backend/seed_new_bands.py new file mode 100644 index 0000000..8cd38f4 --- /dev/null +++ b/backend/seed_new_bands.py @@ -0,0 +1,103 @@ +""" +Seed additional band verticals for Fediversion +""" +from sqlmodel import Session, select +from database import engine +from models import Vertical, Scene, VerticalScene + +# New bands to add +NEW_BANDS = [ + { + "name": "Tedeschi Trucks Band", + "slug": "tedeschi-trucks", + "description": "Blues-rock band led by Derek Trucks and Susan Tedeschi. Known for soulful Southern rock and improvisational live shows.", + "is_active": True, + "is_featured": True, + "scenes": ["jam", "blues-rock"] + }, + { + "name": "Ween", + "slug": "ween", + "description": "Eclectic rock duo from New Hope, PA. Known for genre-hopping and devoted fan base (Brownies).", + "is_active": True, + "is_featured": True, + "scenes": ["jam", "alternative"] + }, + { + "name": "moe.", + "slug": "moe", + "description": "Jam band from Buffalo, NY. Founded 1989, known for annual moe.down festival.", + "is_active": True, + "is_featured": True, + "scenes": ["jam"] + }, + { + "name": "The Disco Biscuits", + "slug": "disco-biscuits", + "description": "Electronic jam band from Philadelphia. Pioneers of 'trance fusion' and Camp Bisco festival.", + "is_active": True, + "is_featured": True, + "scenes": ["jam", "electronic"] + }, +] + +# Ensure scenes exist +SCENES_TO_ADD = [ + {"name": "Blues Rock", "slug": "blues-rock", "description": "Blues-influenced rock music"}, + {"name": "Alternative", "slug": "alternative", "description": "Alternative and indie rock"}, + {"name": "Electronic", "slug": "electronic", "description": "Electronic and dance music"}, +] + + +def seed_bands(): + with Session(engine) as session: + # First ensure scenes exist + for scene_data in SCENES_TO_ADD: + existing = session.exec( + select(Scene).where(Scene.slug == scene_data["slug"]) + ).first() + if not existing: + scene = Scene(**scene_data) + session.add(scene) + print(f"Added scene: {scene_data['name']}") + session.commit() + + # Now add bands + for band_data in NEW_BANDS: + existing = session.exec( + select(Vertical).where(Vertical.slug == band_data["slug"]) + ).first() + + if existing: + print(f"āœ“ {band_data['name']} already exists") + continue + + # Extract scenes before creating vertical + scene_slugs = band_data.pop("scenes", []) + + vertical = Vertical(**band_data) + session.add(vertical) + session.flush() # Get the ID + + # Link to scenes + for slug in scene_slugs: + scene = session.exec( + select(Scene).where(Scene.slug == slug) + ).first() + if scene: + link = VerticalScene(vertical_id=vertical.id, scene_id=scene.id) + session.add(link) + + print(f"āœ… Added: {band_data['name']}") + + session.commit() + + # Show all verticals + all_verts = session.exec(select(Vertical).where(Vertical.is_active == True)).all() + print(f"\nšŸ“Š Total active verticals: {len(all_verts)}") + for v in all_verts: + print(f" - {v.name} ({v.slug})") + + +if __name__ == "__main__": + seed_bands()