Update app.py
Browse files
app.py
CHANGED
@@ -78,10 +78,10 @@ def download_track(track_id: str, quality: str = "MP3_320"):
|
|
78 |
downloaded_files = os.listdir("downloads")
|
79 |
logger.warning(f"Files in downloads directory: {downloaded_files}")
|
80 |
|
81 |
-
# Try to find the file with a
|
82 |
found_filepath = None
|
83 |
for file in downloaded_files:
|
84 |
-
if track_title.lower() in file.lower()
|
85 |
found_filepath = os.path.join("downloads", file)
|
86 |
logger.info(f"Found matching file: {found_filepath}")
|
87 |
break
|
|
|
78 |
downloaded_files = os.listdir("downloads")
|
79 |
logger.warning(f"Files in downloads directory: {downloaded_files}")
|
80 |
|
81 |
+
# Try to find the file with a more flexible approach
|
82 |
found_filepath = None
|
83 |
for file in downloaded_files:
|
84 |
+
if (track_title.lower() in file.lower() or artist_name.lower() in file.lower()) and file.lower().endswith('.mp3'):
|
85 |
found_filepath = os.path.join("downloads", file)
|
86 |
logger.info(f"Found matching file: {found_filepath}")
|
87 |
break
|