tecuts commited on
Commit
fce4c15
·
verified ·
1 Parent(s): bb24960

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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 similar name
82
  found_filepath = None
83
  for file in downloaded_files:
84
- if track_title.lower() in file.lower() and artist_name.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