Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,8 +43,10 @@ def download_audio(streaming_url, output_path, headers):
|
|
| 43 |
|
| 44 |
async def identify_track(shazam, audio_chunk, temp_dir):
|
| 45 |
try:
|
|
|
|
| 46 |
temp_file = os.path.join(temp_dir, 'temp_chunk.wav')
|
| 47 |
-
audio_chunk.export(
|
|
|
|
| 48 |
result = await shazam.recognize_file(temp_file)
|
| 49 |
if result and 'track' in result:
|
| 50 |
track_data = result['track']
|
|
@@ -57,8 +59,8 @@ async def identify_track(shazam, audio_chunk, temp_dir):
|
|
| 57 |
return f"Fehler bei der Identifizierung des Tracks: {str(e)}"
|
| 58 |
|
| 59 |
async def process_dj_set(track_url, progress=gr.Progress()):
|
| 60 |
-
|
| 61 |
-
output_path = os.path.join(
|
| 62 |
tracklist_path = os.path.join(temp_dir, 'tracklist.txt')
|
| 63 |
status_messages = []
|
| 64 |
|
|
|
|
| 43 |
|
| 44 |
async def identify_track(shazam, audio_chunk, temp_dir):
|
| 45 |
try:
|
| 46 |
+
output_directory = "/tmp"
|
| 47 |
temp_file = os.path.join(temp_dir, 'temp_chunk.wav')
|
| 48 |
+
audio_chunk.export(output_directory, format='wav')
|
| 49 |
+
|
| 50 |
result = await shazam.recognize_file(temp_file)
|
| 51 |
if result and 'track' in result:
|
| 52 |
track_data = result['track']
|
|
|
|
| 59 |
return f"Fehler bei der Identifizierung des Tracks: {str(e)}"
|
| 60 |
|
| 61 |
async def process_dj_set(track_url, progress=gr.Progress()):
|
| 62 |
+
output_directory = "/tmp" # Verwenden Sie tempfile für temporäre Verzeichnisse
|
| 63 |
+
output_path = os.path.join(output_directory, 'track.wav')
|
| 64 |
tracklist_path = os.path.join(temp_dir, 'tracklist.txt')
|
| 65 |
status_messages = []
|
| 66 |
|