Various fixes

Trunk + mod

FIx
This commit is contained in:
2023-06-23 20:06:18 +02:00
committed by migatu
parent 0a39eba723
commit dc9946533e
6 changed files with 115 additions and 13 deletions
+14 -12
View File
@@ -24,7 +24,7 @@ from logging import handlers
from pathlib import Path, PurePath
from platform import uname
from sys import platform
from typing import List, TypedDict, Optional
from typing import List, Optional, TypedDict
# *==============Imported libraries
import discord
@@ -53,10 +53,12 @@ Music_Config = TypedDict(
)
# *=========================================== Predefines
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s")
MASTER_TIMEOUT = datetime.now()
INITIAL_TIME_WAIT = 5
MUZYKA: Music_Config = {"playing": False, "ctx": None, "queue": [], "requestor": []}
MUZYKA: Music_Config = {"playing": False,
"ctx": None, "queue": [], "requestor": []}
LOGFILE = ""
NETRC_FILE = ""
@@ -363,7 +365,6 @@ async def disconnect(ctx):
# trunk-ignore(pylint/R0915)
# trunk-ignore(pylint/R0914)
# trunk-ignore(pylint/R0912)
async def play(ctx, zamawial=None, arg=None):
"""
@@ -449,7 +450,6 @@ async def check():
"""Funkcja sprawdzająca czy grać następny kawałek."""
while True:
# TODO: Tu dołożyć skanowanie rozmiaru pliku logowania oraz plików pamięci i przenoszenie ich na większy dysk.
# TODO: Dodać typing i dać znać że wykonuje operacje porządkowania Baru (zamiata, układa szklanki itp.)
# trunk-ignore(codespell/misspelled)
# TODO: dlaczego sie tu wypierdala
if client.voice_clients:
@@ -631,7 +631,8 @@ async def get_file(ctx, source, link):
item_type, item_id = spotify.parse_spotify_url(link)
if item_id:
file_list = spotify.fetch_tracks(spotify_ctrl, item_type, link)
directory_name = spotify.get_item_name(spotify_ctrl, item_type, item_id)
directory_name = spotify.get_item_name(
spotify_ctrl, item_type, item_id)
url_data = {"urls": []}
url_dict = {}
url_dict["save_path"] = Path(
@@ -788,10 +789,8 @@ async def wyszukaj(ctx, how_many=0):
logger.info("Słowo kluczowe: %s", word)
itr = 0
for file in music_file_list:
if platform == "win32":
file = file.split("\\")
else:
file = file.split("/")
file = file.split(SEPARATOR_FILE_PATH)
char_remove = [
".",
"^",
@@ -804,6 +803,7 @@ async def wyszukaj(ctx, how_many=0):
"[",
"]",
"\\",
"/",
"|",
"(",
")",
@@ -832,13 +832,15 @@ async def wyszukaj(ctx, how_many=0):
if re.match(pattern, itm, re.IGNORECASE):
temp_weight = (
search_weight[itr][0]
+ (token_weight + (pingu**1.5) / pattern_len) / matched_times
+ (token_weight + (pingu**1.5) /
pattern_len) / matched_times
)
search_weight[itr] = temp_weight, music_file_list[itr]
matched_times += 1
itr += 1
logger.info("Stworzylem tablice wag zajęło mi to %s", datetime.now() - time_start)
logger.info("Stworzylem tablice wag zajęło mi to %s",
datetime.now() - time_start)
time_start = datetime.now()
item_to_search = await max_weight(search_weight)
itr = 0