feat: Add seed script for TTB, Ween, moe., Disco Biscuits
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
This commit is contained in:
parent
0bdb7ca8f6
commit
ee89fcef7e
1 changed files with 103 additions and 0 deletions
103
backend/seed_new_bands.py
Normal file
103
backend/seed_new_bands.py
Normal file
|
|
@ -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()
|
||||
Loading…
Add table
Reference in a new issue