Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ app = FastAPI(title="Deezer API")
|
|
23 |
load_dotenv()
|
24 |
|
25 |
# Mount a static files directory to serve downloaded files
|
26 |
-
|
27 |
os.makedirs("downloads", exist_ok=True)
|
28 |
app.mount("/downloads", StaticFiles(directory="downloads"), name="downloads")
|
29 |
|
@@ -71,6 +71,7 @@ class DownloadRequest(BaseModel):
|
|
71 |
def download_spotify_track(track_id: str):
|
72 |
try:
|
73 |
# Clear the downloads directory
|
|
|
74 |
for item in downloads_dir.iterdir():
|
75 |
if item.is_file():
|
76 |
item.unlink()
|
|
|
23 |
load_dotenv()
|
24 |
|
25 |
# Mount a static files directory to serve downloaded files
|
26 |
+
|
27 |
os.makedirs("downloads", exist_ok=True)
|
28 |
app.mount("/downloads", StaticFiles(directory="downloads"), name="downloads")
|
29 |
|
|
|
71 |
def download_spotify_track(track_id: str):
|
72 |
try:
|
73 |
# Clear the downloads directory
|
74 |
+
downloads_dir = Path("downloads")
|
75 |
for item in downloads_dir.iterdir():
|
76 |
if item.is_file():
|
77 |
item.unlink()
|