This commit is contained in:
2024-09-19 21:49:03 +02:00
parent 48fce96250
commit 80360e0dde
+3 -21
View File
@@ -10,35 +10,16 @@ import time
# Replace with your API key
aai.settings.api_key = "aa9962f0088a449a9c4ab2361e96cc08"
discord.opus._load_default()
# VoiceState
# self_mute=False
# self_deaf=False
# self_stream=False
# suppress=False
# requested_to_speak_at=None
# channel=<VoiceChannel id=1285599336318632036
# name='testing'
# rtc_region=None
# position=10
# bitrate=64000
# video_quality_mode=<VideoQualityMode.auto: 1>
# user_limit=0
# category_id=1084451744496496753
# URL of the file to transcribe
# You can also transcribe a local file by passing in a file path
# FILE_URL = './path/to/file.mWp3
CHANNELS = OpusDecoder.CHANNELS
SAMPLE_WIDTH = OpusDecoder.SAMPLE_SIZE // OpusDecoder.CHANNELS
SAMPLING_RATE = OpusDecoder.SAMPLING_RATE
#rotate file after there is 0.5s between last received pcm for user.
#delete messsages after user disconnect
logger = logging.getLogger("discord")
location = "/home/pi/Conjurer/transcripts/"
class WaveWriter:
def __init__(self, user_id):
@@ -167,11 +148,12 @@ class Transcriber(commands.Cog):
@tasks.loop(seconds=0.5)
async def check_data(self):
for item in self.wsink.wavewriter.values():
if time.time_ns() - item[1] > 10000:
pass
logger.info(item[0])
logger.info(item[1])
logger.info(item[2])
logger.info(time.time_ns())
logger.info("Diff : %s", time.time_ns() - item[1])
@commands.Cog.listener()
async def on_voice_state_update(self, user, before, after):
if before.channel is None: