Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
testing loop by default
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import gradio as gr
|
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
import os
|
| 7 |
import threading
|
|
|
|
| 8 |
|
| 9 |
# Load environment variables
|
| 10 |
load_dotenv()
|
|
@@ -42,6 +43,10 @@ class MusicBot:
|
|
| 42 |
audio_source = discord.FFmpegPCMAudio("assets/sample.mp3")
|
| 43 |
def after_playing(e):
|
| 44 |
self.is_playing = False
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
self.voice_client.play(audio_source, after=after_playing)
|
| 46 |
except Exception as e:
|
| 47 |
print(f"Error playing file: {e}")
|
|
|
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
import os
|
| 7 |
import threading
|
| 8 |
+
import asyncio
|
| 9 |
|
| 10 |
# Load environment variables
|
| 11 |
load_dotenv()
|
|
|
|
| 43 |
audio_source = discord.FFmpegPCMAudio("assets/sample.mp3")
|
| 44 |
def after_playing(e):
|
| 45 |
self.is_playing = False
|
| 46 |
+
# test loop by default
|
| 47 |
+
if e:
|
| 48 |
+
print(f"Playback error: {e}")
|
| 49 |
+
asyncio.run_coroutine_threadsafe(self.play_next(ctx), bot.loop)
|
| 50 |
self.voice_client.play(audio_source, after=after_playing)
|
| 51 |
except Exception as e:
|
| 52 |
print(f"Error playing file: {e}")
|