diff --git a/voice_recognition.py b/voice_recognition.py index 9f555ad..cf5ed4b 100644 --- a/voice_recognition.py +++ b/voice_recognition.py @@ -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= -# 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: