diff --git a/backend/main.py b/backend/main.py index 6616c8b..7efed18 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,6 +1,7 @@ from fastapi import FastAPI, Query, HTTPException from fastapi.responses import JSONResponse from fastapi.middleware.cors import CORSMiddleware +from fastapi import APIRouter import os from downloader import download_song @@ -26,6 +27,15 @@ def download(query: str = Query(..., min_length=2)): except Exception as e: raise HTTPException(status_code=500, detail=str(e)) +@app.get("/songs", summary="List downloaded songs") +def list_songs(): + try: + files = os.listdir(settings.MUSIC_DIR) + songs = [f for f in files if f.endswith(".mp3")] + return {"songs": sorted(songs)} + except Exception as e: + raise HTTPException(status_code=500, detail=f"Failed to read songs: {str(e)}") + if __name__ == "__main__": import uvicorn uvicorn.run("main:app", host="0.0.0.0", port=8000, log_level="info", reload=True) \ No newline at end of file diff --git a/frontend/.vscode/extensions.json b/frontend/.vscode/extensions.json deleted file mode 100644 index a7cea0b..0000000 --- a/frontend/.vscode/extensions.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "recommendations": ["Vue.volar"] -} diff --git a/frontend/README.md b/frontend/README.md index 33895ab..7059a96 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,5 +1,12 @@ -# Vue 3 + TypeScript + Vite +# React + Vite -This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 ` +
+