Update app.py
Browse files
app.py
CHANGED
@@ -27,6 +27,8 @@ DEEZER_API_URL = "https://api.deezer.com"
|
|
27 |
ARL_TOKEN = os.getenv('ARL')
|
28 |
dl = DeeLogin(arl=ARL_TOKEN)
|
29 |
|
|
|
|
|
30 |
@app.get("/")
|
31 |
def read_root():
|
32 |
return {"message": "running"}
|
@@ -87,15 +89,17 @@ def download_track(track_id: str, quality: str = "MP3_320"):
|
|
87 |
if len(downloaded_files) == 0:
|
88 |
raise HTTPException(status_code=500, detail="File download failed")
|
89 |
|
90 |
-
|
|
|
91 |
|
92 |
# Return the download URL
|
93 |
-
download_url = f"/downloads/{os.path.basename(
|
94 |
logger.info(f"Download successful: {download_url}")
|
95 |
return {"download_url": download_url}
|
96 |
except Exception as e:
|
97 |
logger.error(f"Error downloading track: {e}")
|
98 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
99 |
|
100 |
# Search tracks using Deezer API
|
101 |
@app.get("/search")
|
|
|
27 |
ARL_TOKEN = os.getenv('ARL')
|
28 |
dl = DeeLogin(arl=ARL_TOKEN)
|
29 |
|
30 |
+
Base_URL= "https://tecuts-depot.hf.space"
|
31 |
+
|
32 |
@app.get("/")
|
33 |
def read_root():
|
34 |
return {"message": "running"}
|
|
|
89 |
if len(downloaded_files) == 0:
|
90 |
raise HTTPException(status_code=500, detail="File download failed")
|
91 |
|
92 |
+
found_file = downloaded_files[0]
|
93 |
+
found_filepath = os.path.join("downloads", found_file)
|
94 |
|
95 |
# Return the download URL
|
96 |
+
download_url = f"/downloads/{os.path.basename(found_file)}"
|
97 |
logger.info(f"Download successful: {download_url}")
|
98 |
return {"download_url": download_url}
|
99 |
except Exception as e:
|
100 |
logger.error(f"Error downloading track: {e}")
|
101 |
raise HTTPException(status_code=500, detail=str(e))
|
102 |
+
|
103 |
|
104 |
# Search tracks using Deezer API
|
105 |
@app.get("/search")
|