Radio hardkor

This commit is contained in:
2024-04-23 10:42:19 +02:00
parent 3b8833cd3b
commit 59558ba1af
+36 -7
View File
@@ -139,6 +139,7 @@ GET_MP3 = "/mp3"
SEND_MP3 = "/update_mp3"
GET_PLAYLIST = "/get_music"
ADD_TO_PRIO_PLAYLIST = "/add_to_priority"
REQUEST_MUSIC = "/request_radio_file"
CLEAR_PRIO = "/clear_pr_pls"
LIBRARIAN_SERVICE_ADDRESS = "http://192.168.1.192:5001"
SEND_QUERY = "/query"
@@ -1579,20 +1580,19 @@ async def graj_muzyko(ctx):
)
async def radio_hardkor(ctx):
"""
Async function named "graj_muzyko" starts music playback on channel "Nocna Zmiana".
Plays the radio hardkor stream in the voice channel.
:param ctx: ctx stands for "context" and is a parameter commonly used in Discord.py commands. It
represents the context in which the command was invoked, including information such as the message,
the channel, the server, and the user who invoked the command. This parameter is required in all
Discord.py commands
Args:
ctx: The context object representing the invocation context.
Returns:
None
"""
logger.info("Press play on radio hardkor")
async with ctx.typing():
global MUZYKA # pylint: disable=global-variable-not-assigned
MUZYKA["ctx"] = ctx
await connect(ctx=ctx)
await play(ctx=ctx)
logger.info("Press play on radio completed")
voice_client = client.voice_clients[0]
if not client.voice_clients:
@@ -1781,7 +1781,36 @@ async def dodaj_do_ulubionych(ctx):
timeout=360,
)
_ = await coroutine
@client.hybrid_command(
name="ja_chiol",
description="Dodaje do listy ulubionych w radiu",
guild=discord.Object(id=664789470779932693),
)
async def request_radio(ctx):
"""
Generate a playlist in queue. First word in this command shall be int defining length of the playlist.
Rest of the line are search terms.
:param ctx: ctx stands for "context" and is a parameter commonly used in Discord.py commands. It
represents the context in which the command was invoked, including information such as the message,
the channel, the server, and the user who invoked the command. This parameter is required in all
Discord.py commands
"""
async with ctx.typing():
logger.info("Zaczynam szukać timestamp %s", datetime.now())
word_list = ctx.message.content.split()
jrequest = {
"lista_slow": word_list,
"UUID": str(uuid.uuid4()),
}
coroutine = asyncio.to_thread(
requests.post,
f"{FILE_SERVICE_ADDRESS}{REQUEST_MUSIC}",
json=jrequest,
timeout=360,
)
_ = await coroutine
@client.hybrid_command(
name="wyczysc_ulubione",
description="Czysci liste ulubionych w radiu",