[scripts/discord-stream-desktop-audio] allow specifying the audio device

This commit is contained in:
Dmytro Meleshko 2021-02-12 10:51:34 +02:00 committed by pull[bot]
parent b0eef79602
commit 6fc06191a5
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import os
guild_id = int(sys.argv[1])
voice_channel_id = int(sys.argv[2])
pulseaudio_device = sys.argv[3]
with open(os.path.expanduser("~/.config/dotfiles/discord-tools-user-token.txt")) as f:
bot_token = f.read().strip()
@ -28,7 +29,7 @@ async def on_ready():
voice_client = await voice_channel.connect()
print("connected to {0} ({0.id}) in {1} ({1.id})".format(voice_channel, guild))
source = discord.FFmpegPCMAudio("default", before_options="-f pulse")
source = discord.FFmpegPCMAudio(pulseaudio_device, before_options="-f pulse")
voice_client.play(
source, after=lambda e: print("Player error: %s" % e) if e else None
)