This commit is contained in:
2024-09-19 18:13:36 +02:00
parent 373ea608d9
commit cb8ad5ca08
+13 -17
View File
@@ -36,22 +36,6 @@ logger = logging.getLogger("discord")
location = "/home/pi/Conjurer/"
class Events(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_voice_state_update(self, user, before, after):
if before.channel is None:
logger.info("User %s connected to channel %s", user, after.channel.name)
elif after.channel is None:
logger.info("User %s disconnected from channel %s", user, before.channel.name)
else:
logger.info("User VC status changed %s", user)
logger.info("Before %s", before)
logger.info("After %s", after)
class WaveWriter:
def __init__(self, user_id):
@@ -94,6 +78,7 @@ class WaveWriter:
# send present to transcription
def writeframes(self, pcmdata):
logger.info(self.transcript_file_present)
self.transcript_file_present.writeframes(pcmdata)
def cleanup(self):
@@ -170,6 +155,18 @@ class Transcriber(commands.Cog):
logger.info(self.bot.voice_clients)
vc.listen(self.wsink)
@commands.Cog.listener()
async def on_voice_state_update(self, user, before, after):
if before.channel is None:
logger.info("User %s connected to channel %s", user, after.channel.name)
elif after.channel is None:
logger.info("User %s disconnected from channel %s", user, before.channel.name)
else:
logger.info("User VC status changed %s", user)
logger.info("Before %s", before)
logger.info("After %s", after)
@commands.command(name="stop_transcribe")
async def stop(self, ctx):
await ctx.voice_client.disconnect()
@@ -177,7 +174,6 @@ class Transcriber(commands.Cog):
async def setup(bot):
await bot.add_cog(Transcriber(bot))
await bot.add_cog(Events(bot))
# 1. zapisuj kwestie człowieka do pliku w którym będzie można stwierdzić kto co powiedział (callback z basicaudio + write z wavesinka). Zamykaj plik i wysyłaj do transkrypcji w momencie ciszy dłuższej niż 0.5s. Jeśli człowiek nadaje cały czas dawaj sygnał że nie można go transkrybować - i wyłaczaj zapis.