Parametryzacja "muzyki mojego ludu"

This commit is contained in:
2023-07-19 13:18:55 +02:00
committed by migatu
parent 1c240342c5
commit fd742c8f1c
3 changed files with 81 additions and 3 deletions
+4
View File
@@ -6,4 +6,8 @@
plugins plugins
user_trunk.yaml user_trunk.yaml
user.yaml user.yaml
<<<<<<< HEAD
tmp tmp
=======
tools
>>>>>>> c7dc465 (Parametryzacja "muzyki mojego ludu")
+37
View File
@@ -2,6 +2,7 @@
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml # To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1 version: 0.1
cli: cli:
<<<<<<< HEAD
version: 1.20.1 version: 1.20.1
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins) # Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins: plugins:
@@ -10,10 +11,44 @@ plugins:
ref: v1.4.5 ref: v1.4.5
uri: https://github.com/trunk-io/plugins uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) # Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
=======
version: 1.12.1
plugins:
sources:
- id: trunk
ref: v0.0.22
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- actionlint@1.6.25
- markdownlint@0.35.0
- trivy@0.43.1
- trufflehog@3.44.0
- pylint
- codespell
- cspell
- git-diff-check
- eslint
- prettier
- semgrep
- autopep8
- bandit
- black
- flake8
- isort
- mypy
- pylint
- ruff
- semgrep
- yapf
- gitleaks
>>>>>>> c7dc465 (Parametryzacja "muzyki mojego ludu")
runtimes: runtimes:
enabled: enabled:
- node@18.12.1 - node@18.12.1
- python@3.10.8 - python@3.10.8
<<<<<<< HEAD
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) # This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint: lint:
enabled: enabled:
@@ -31,6 +66,8 @@ lint:
- trivy@0.50.1 - trivy@0.50.1
- trufflehog@3.71.0 - trufflehog@3.71.0
- yamllint@1.35.1 - yamllint@1.35.1
=======
>>>>>>> c7dc465 (Parametryzacja "muzyki mojego ludu")
actions: actions:
disabled: disabled:
- trunk-announce - trunk-announce
+40 -3
View File
@@ -68,6 +68,11 @@ MEMORY_FIVE_MUZYKA = ""
SETTINGS_FILE = "" SETTINGS_FILE = ""
ENCODING = "" ENCODING = ""
GRAPHICS_PATH = "" GRAPHICS_PATH = ""
MUZYKA_MOJEGO_LUDU_HISTORIA = 1500
MUZYKA_MOJEGO_LUDU_SLOWA_KLUCZOWE = 30
MUZYKA_MOJEGO_LUDU_PLAJLISTA = 30
# *=========================================== Platform Specific Predefines # *=========================================== Platform Specific Predefines
if platform in ("linux", "linux2"): if platform in ("linux", "linux2"):
@@ -187,7 +192,6 @@ async def on_ready():
logger.debug("%s has connected to Discord!", client.user) logger.debug("%s has connected to Discord!", client.user)
await client.change_presence(activity=discord.Game(name="Axe Throwing Darts")) await client.change_presence(activity=discord.Game(name="Axe Throwing Darts"))
await client.tree.sync() await client.tree.sync()
# await tree.sync(guild=discord.Object(id=Your guild id))
await check() await check()
@@ -1530,6 +1534,7 @@ async def get_image_stable_diffusion(ctx):
description="Gra muzyke wyszukana na bazie tematow konwersacji na kanale NZ", description="Gra muzyke wyszukana na bazie tematow konwersacji na kanale NZ",
guild=discord.Object(id=664789470779932693), guild=discord.Object(id=664789470779932693),
) )
# trunk-ignore(pylint/R0912)
async def zagraj_muzyke_mego_ludu(ctx): async def zagraj_muzyke_mego_ludu(ctx):
""" """
Play completeley random playlist based on messaging history. Play completeley random playlist based on messaging history.
@@ -1541,7 +1546,7 @@ async def zagraj_muzyke_mego_ludu(ctx):
""" """
stats = {} stats = {}
if ctx: if ctx:
stat_iter = get_stats(ctx, 1500) stat_iter = get_stats(ctx, MUZYKA_MOJEGO_LUDU_HISTORIA)
async for name, how_many in stat_iter: async for name, how_many in stat_iter:
if len(name) > 3: if len(name) > 3:
stats[name] = how_many stats[name] = how_many
@@ -1556,7 +1561,7 @@ async def zagraj_muzyke_mego_ludu(ctx):
async with ctx.typing(): async with ctx.typing():
logger.info("Zaczynam szukać timestamp %s", datetime.now()) logger.info("Zaczynam szukać timestamp %s", datetime.now())
search_time_glob = datetime.now() search_time_glob = datetime.now()
file = await wyszukaj(ctx=ctx, how_many=100, slowa_kluczowe=key_words[:30]) file = await wyszukaj(ctx=ctx, how_many=MUZYKA_MOJEGO_LUDU_PLAJLISTA, slowa_kluczowe=key_words[:MUZYKA_MOJEGO_LUDU_SLOWA_KLUCZOWE])
logger.info( logger.info(
"Koniec szukania(timestamp %s zajęło %s", "Koniec szukania(timestamp %s zajęło %s",
datetime.now(), datetime.now(),
@@ -1596,6 +1601,38 @@ async def zagraj_muzyke_mego_ludu(ctx):
logger.info("Plejlista zrobiona") logger.info("Plejlista zrobiona")
# trunk-ignore(mypy/arg-type)
@client.hybrid_command(
name="parametry_muzyki_mego_ludu",
description="Konfiguruje komende zagraj muzyke mojego ludu",
guild=discord.Object(id=664789470779932693),
)
async def parametry_muzyki_mego_ludu(ctx, ile_historii=1500, ile_slow_kluczowych=30, jak_dluga_plejlista=30):
"""
The function `parametry_muzyki_mego_ludu` sets global variables for the number of history entries,
number of keywords, and length of playlist for a music application.
:param ctx: The `ctx` parameter is typically used in Discord.py, a Python library for creating
Discord bots. It represents the context of the command being executed, including information about
the message, the server, and the user who invoked the command
:param ile_historii: The parameter "ile_historii" represents the number of history items for the
music playlist, defaults to 1500 (optional)
:param ile_slow_kluczowych: The parameter "ile_slow_kluczowych" represents the number of keywords or
key phrases related to music that you want to include in your analysis or search, defaults to 30
(optional)
:param jak_dluga_plejlista: The parameter "jak_dluga_plejlista" determines the length of the
playlist. It specifies how many songs should be included in the playlist, defaults to 30 (optional)
"""
if ctx:
global MUZYKA_MOJEGO_LUDU_HISTORIA # pylint: disable=global-statement
MUZYKA_MOJEGO_LUDU_HISTORIA = ile_historii
global MUZYKA_MOJEGO_LUDU_SLOWA_KLUCZOWE # pylint: disable=global-statement
MUZYKA_MOJEGO_LUDU_SLOWA_KLUCZOWE = ile_slow_kluczowych
global MUZYKA_MOJEGO_LUDU_PLAJLISTA # pylint: disable=global-statement
MUZYKA_MOJEGO_LUDU_PLAJLISTA = jak_dluga_plejlista
# *================================== Run # *================================== Run
# trunk-ignore(mypy/arg-type) # trunk-ignore(mypy/arg-type)
client.run(TOKEN) client.run(TOKEN)