mirror of
https://github.com/bnair123/MusicAnalyser.git
synced 2026-02-25 11:46:07 +00:00
feat: Initial backend setup for Music Analyser
- Created FastAPI backend structure. - Implemented Spotify Recently Played ingestion logic. - Set up SQLite database with SQLAlchemy models. - Added AI Service using Google Gemini. - Created helper scripts for auth and background worker. - Added Dockerfile and GitHub Actions workflow.
This commit is contained in:
28
backend/run_ingest.py
Normal file
28
backend/run_ingest.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import asyncio
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add the current directory to sys.path to allow imports from app
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
from app.database import SessionLocal, Base, engine
|
||||
from app.ingest import ingest_recently_played
|
||||
|
||||
# Ensure tables exist
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
async def main():
|
||||
print("Starting manual ingestion...")
|
||||
db = SessionLocal()
|
||||
try:
|
||||
await ingest_recently_played(db)
|
||||
print("Ingestion complete.")
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user