mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Fucking windows bugfix and playlist gen fix
Kurwa bugfix pod windowsa Fixed playlist gen
This commit is contained in:
@@ -42,6 +42,8 @@ if platform == "linux" or platform == "linux2":
|
||||
music_folder = "/home/pi/RetroPie/mp3/"
|
||||
settings_file = "/home/pi/Conjurer/settings.json"
|
||||
netrc_file = "/home/pi/.netrc"
|
||||
logstore = "/home/pi/RetroPie/logs/"
|
||||
|
||||
elif platform == "win32":
|
||||
logfile = "discord.log"
|
||||
memory_five_siara = "pamiec.json"
|
||||
@@ -50,6 +52,7 @@ elif platform == "win32":
|
||||
music_folder = "G:\\Muzyka\\"
|
||||
settings_file = "settings.json"
|
||||
netrc_file = "C:\\Users\\mtusz\\.netrc"
|
||||
logstore = "C:\\Users\\mtusz\\OneDrive\\Pulpit\\Conjurer\\logs\\"
|
||||
|
||||
# *=========================================== Keys
|
||||
netrc = netrc.netrc(netrc_file)
|
||||
@@ -138,9 +141,12 @@ async def on_message(message):
|
||||
|
||||
if ("Conjurer Śpij Słodko Aniołku" in message.content) and vykidailo:
|
||||
exit()
|
||||
|
||||
#kanal bez bota
|
||||
if message.channel.id == 1095985579147141202:
|
||||
return
|
||||
#wentylacja
|
||||
if message.channel.id == 1083804024173764739:
|
||||
return
|
||||
|
||||
if isinstance(message.channel, discord.DMChannel):
|
||||
channel = client.get_channel(1064888712565100614)
|
||||
@@ -296,7 +302,7 @@ async def play(ctx, zamawial=None, arg=None):
|
||||
|
||||
voiceClient.play(
|
||||
discord.PCMVolumeTransformer(
|
||||
discord.FFmpegPCMAudio(source=file_to_play), volume=0.15
|
||||
discord.FFmpegPCMAudio(source=file_to_play), volume=0.3
|
||||
)
|
||||
) # NIE DOTYKAC POKRĘTŁA GŁOŚNOŚCI!!!!
|
||||
if query:
|
||||
@@ -335,7 +341,7 @@ async def check():
|
||||
if not voiceClient.is_playing() and not voiceClient.is_paused():
|
||||
await play(MUZYKA["ctx"], MUZYKA["requestor"])
|
||||
if os.path.getsize(logfile) > 600000:
|
||||
shutil.copyfile(logfile,"/home/pi/RetroPie/logs/discord{}.log".format(datetime.now()))
|
||||
shutil.copyfile(logfile,"{}discord{}.log".format(logstore, datetime.now()))
|
||||
logger.info("Log rollover")
|
||||
handler.doRollover()
|
||||
await asyncio.sleep(60)
|
||||
@@ -528,8 +534,13 @@ async def wyszukaj(ctx, how_many=0):
|
||||
search_weight.append((0, ""))
|
||||
|
||||
time_start = datetime.now()
|
||||
for word in word_list[1:]:
|
||||
if int(how_many) > 0:
|
||||
skip_start = 2
|
||||
else:
|
||||
skip_start = 1
|
||||
for word in word_list[skip_start:]:
|
||||
token_weight = len(word)
|
||||
logger.info("Słowo kluczowe: {}".format(word))
|
||||
itr = 0
|
||||
for file in music_file_list:
|
||||
if platform == "win32":
|
||||
@@ -565,7 +576,6 @@ async def wyszukaj(ctx, how_many=0):
|
||||
all_words.extend(tmp)
|
||||
pingu = 1
|
||||
pattern_len = len(all_words)
|
||||
plapka = False
|
||||
if platform == "win32":
|
||||
skip = 2
|
||||
else:
|
||||
@@ -580,10 +590,8 @@ async def wyszukaj(ctx, how_many=0):
|
||||
+ (token_weight + (pingu**1.5) / pattern_len) / matched_times
|
||||
)
|
||||
search_weight[itr] = temp_weight, music_file_list[itr]
|
||||
|
||||
matched_times += 1
|
||||
itr += 1
|
||||
await asyncio.sleep(1e-3)
|
||||
|
||||
logger.info(
|
||||
"Stworzylem tablice wag zajęło mi to {}".format(datetime.now() - time_start)
|
||||
@@ -597,30 +605,17 @@ async def wyszukaj(ctx, how_many=0):
|
||||
return_list = []
|
||||
if int(how_many) <= 0:
|
||||
logger.info("Jeden plik do zagrania")
|
||||
|
||||
while not_found:
|
||||
if search_weight[itr][0] == item_to_search:
|
||||
return_list.append(search_weight[itr][1])
|
||||
return_list.append(search_weight[itr])
|
||||
return return_list
|
||||
itr += 1
|
||||
else:
|
||||
logger.info("Wiele plików do zagrania")
|
||||
for i in range(int(how_many)):
|
||||
item_to_search = await max_weight(search_weight)
|
||||
while not_found:
|
||||
if search_weight[itr][0] == item_to_search:
|
||||
return_list.append(search_weight[itr][1])
|
||||
search_weight.remove(search_weight[itr])
|
||||
itr = 0
|
||||
logger.info("Zajęło mi to {}".format(datetime.now() - time_start))
|
||||
item_to_search = await max_weight(search_weight)
|
||||
else:
|
||||
itr += 1
|
||||
if await max_weight(search_weight) < 5:
|
||||
return return_list
|
||||
if len(return_list) >= int(how_many):
|
||||
logger.info("Zajęło mi to {}".format(datetime.now() - time_start))
|
||||
return return_list
|
||||
search_weight.sort(key = lambda x: x[0],reverse=True)
|
||||
return_list.extend(search_weight[:int(how_many)])
|
||||
return return_list
|
||||
|
||||
|
||||
|
||||
async def max_weight(list):
|
||||
@@ -878,11 +873,11 @@ async def zagraj_mi_kawalek(ctx, arg=None):
|
||||
if file:
|
||||
for plik in file:
|
||||
global MUZYKA
|
||||
MUZYKA["queue"].insert(0, plik)
|
||||
MUZYKA["queue"].insert(0, plik[1])
|
||||
MUZYKA["requestor"].insert(0, ctx.author)
|
||||
metadata = eyed3.load(plik)
|
||||
metadata = eyed3.load(plik[1])
|
||||
reply = "Dodałem do playlisty {} z prywatnej kolekcji Hammera.".format(
|
||||
plik
|
||||
plik[1]
|
||||
)
|
||||
if metadata.tag.title:
|
||||
reply = "Dodałem do playlisty kawalek {}".format(metadata.tag.title)
|
||||
@@ -914,11 +909,11 @@ async def zrob_mi_plejliste(ctx, *arg):
|
||||
if file:
|
||||
for plik in file:
|
||||
global MUZYKA
|
||||
MUZYKA["queue"].insert(0, plik)
|
||||
MUZYKA["queue"].insert(0, plik[1])
|
||||
MUZYKA["requestor"].insert(0, ctx.author)
|
||||
metadata = eyed3.load(plik)
|
||||
metadata = eyed3.load(plik[1])
|
||||
reply = "Dodałem do playlisty {} z prywatnej kolekcji Hammera.".format(
|
||||
plik
|
||||
plik[1]
|
||||
)
|
||||
if metadata.tag.title:
|
||||
reply = "Dodałem do playlisty kawalek {}".format(metadata.tag.title)
|
||||
|
||||
Reference in New Issue
Block a user