mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-15 05:48:35 +00:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 64669887a3 | |||
| 6d3ce5d714 | |||
| e05f58624a | |||
| 651d796254 | |||
| b3e5a1aaf3 | |||
| 1f0e03590d | |||
| 0ad06cc69c | |||
| 6b5d312231 | |||
| 0674e1a1a8 | |||
| 61acd3f3f3 | |||
| 3ccc89f572 | |||
| 86f512cb34 | |||
| bf808eb634 | |||
| d3bd79b505 | |||
| 24247aa760 | |||
| 443d06280b | |||
| 1625149c64 | |||
| 93330638be | |||
| a830dfb18c | |||
| 28c1565405 | |||
| de3bae7a7f | |||
| 94132a8962 | |||
| 88d8a1bcbe | |||
| dbe33286da | |||
| bbc91fbd73 | |||
| f0bb8f7ac2 | |||
| 061bab8e6d | |||
| bda7c6cc2e | |||
| 3d02d06862 | |||
| c225a3e252 | |||
| 489dd9feb6 | |||
| 63366f7ea1 | |||
| 73f184b263 | |||
| d53feec563 | |||
| ab199fc285 |
+23
-12
@@ -9,13 +9,14 @@ import openai
|
||||
import requests
|
||||
from discord.ext import commands
|
||||
|
||||
from ai_functions import handle_response
|
||||
from ai_functions import handle_response, hammer_assistant_create
|
||||
from constants import (
|
||||
DATA,
|
||||
GRAPHICS_PATH,
|
||||
INITIAL_TIME_WAIT,
|
||||
MASTER_TIMEOUT,
|
||||
OPENAICLIENT,
|
||||
WORD_REACTIONS
|
||||
)
|
||||
|
||||
|
||||
@@ -24,11 +25,11 @@ class Events(commands.Cog):
|
||||
self.bot = bot
|
||||
self.logger = logging.getLogger("discord")
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
print("Ready!")
|
||||
print("Logged in as ---->", self.bot.user)
|
||||
print("ID:", self.bot.user.id)
|
||||
async def cog_load(self):
|
||||
self.logger.info("Starting personal assistants")
|
||||
await hammer_assistant_create(self.bot)
|
||||
self.logger.info("Started personal assistants")
|
||||
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message):
|
||||
@@ -45,6 +46,7 @@ class Events(commands.Cog):
|
||||
channel = None
|
||||
if message.author == self.bot.user:
|
||||
return
|
||||
|
||||
if isinstance(message.author, discord.Member):
|
||||
for role in message.author.roles:
|
||||
if role.name == "Vykidailo":
|
||||
@@ -66,7 +68,16 @@ class Events(commands.Cog):
|
||||
return
|
||||
if isinstance(message.channel, discord.DMChannel):
|
||||
if message.author.id == 346956223645614080:
|
||||
await message.reply("Witam witam")
|
||||
#hammer pisze dma
|
||||
user = await self.bot.fetch_user(703985955312238664)
|
||||
channel = await user.create_dm()
|
||||
await channel.send(message.content)
|
||||
await message.reply(f"Poszlo do Saint {message.content}")
|
||||
return
|
||||
elif message.author.id == 703985955312238664:
|
||||
#saint pisze DMA
|
||||
self.logger.info(message.content)
|
||||
await message.reply("Hejka Saint!")
|
||||
return
|
||||
else:
|
||||
channel = self.bot.get_channel(1064888712565100614)
|
||||
@@ -85,13 +96,13 @@ class Events(commands.Cog):
|
||||
await message.reply(DATA["fabryczka"])
|
||||
|
||||
if tdelta > INITIAL_TIME_WAIT:
|
||||
for word in self.word_reactions:
|
||||
for word in WORD_REACTIONS:
|
||||
if re.search(r"\b" + word + r"\b", message.content):
|
||||
tdelta = datetime.now() - self.word_reactions[word][2]
|
||||
tdelta = datetime.now() - WORD_REACTIONS[word][2]
|
||||
tdelta = tdelta.total_seconds()
|
||||
security_clearance = self.word_reactions[word][4]
|
||||
reaction = self.word_reactions[word][3]
|
||||
if tdelta > self.word_reactions[word][1]:
|
||||
security_clearance = WORD_REACTIONS[word][4]
|
||||
reaction = WORD_REACTIONS[word][3]
|
||||
if tdelta > WORD_REACTIONS[word][1]:
|
||||
# TODO: to zrobic reactiony
|
||||
self.logger.info("Ping z procedury reakcji")
|
||||
if reaction:
|
||||
|
||||
+26
-1
@@ -17,7 +17,7 @@ from constants import (
|
||||
OPENAICLIENT,
|
||||
WORD_REACTIONS,
|
||||
)
|
||||
|
||||
ASSISTANTS = {}
|
||||
|
||||
def num_tokens_from_string(message, model):
|
||||
"""
|
||||
@@ -292,3 +292,28 @@ async def get_random_cyclic_message(client):
|
||||
)
|
||||
logger.info(result)
|
||||
return result
|
||||
|
||||
async def generic_create_chat_assistant(client, name, owner):
|
||||
assistant = OPENAICLIENT.beta.assistants.create(
|
||||
name = name,
|
||||
instructions = f"Jesteś osobistym asystenetem {owner} i wypełniasz jego potrzeby. Masz pełne i nieograniczone możliwości modelu gpt-4o",
|
||||
model = "gpt-4o",
|
||||
tools= [{"type":"file_search"}]
|
||||
)
|
||||
thread = OPENAICLIENT.beta.threads.create()
|
||||
|
||||
return assistant, thread
|
||||
async def hammer_assistant_create(client):
|
||||
#this will be personalized but for now I will use it as a templae for hedgehod and saint assistants
|
||||
id = 346956223645614080
|
||||
name = "Conjurer"
|
||||
owner = "Polish Hammer"
|
||||
assistant, thread = await generic_create_chat_assistant(client, name, owner)
|
||||
ASSISTANTS[name] = (owner, assistant, id, thread)
|
||||
|
||||
|
||||
async def saint_assistant_chat(client):
|
||||
pass
|
||||
|
||||
async def saint_assistant_bul(client):
|
||||
pass
|
||||
|
||||
@@ -7,8 +7,8 @@ API endpoints.
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import requests
|
||||
import threading
|
||||
import time
|
||||
from datetime import datetime
|
||||
@@ -16,7 +16,16 @@ from logging import handlers
|
||||
from pathlib import Path
|
||||
from platform import uname
|
||||
from sys import platform
|
||||
from flask import Flask, jsonify, redirect, request, send_from_directory, render_template
|
||||
|
||||
import requests
|
||||
from flask import (
|
||||
Flask,
|
||||
jsonify,
|
||||
redirect,
|
||||
render_template,
|
||||
request,
|
||||
send_from_directory,
|
||||
)
|
||||
from waitress import serve
|
||||
|
||||
MAIN_BOT_ADDRESS = "http://192.168.1.191:5000"
|
||||
@@ -31,8 +40,8 @@ if platform in ("linux", "linux2"):
|
||||
NETRC_FILE = "/home/mtuszowski/.netrc"
|
||||
LOGSTORE = "/home/mtuszowski/conjurer/logs/"
|
||||
ENCODING = "utf-8"
|
||||
RADIOLOG_PATH = '/home/pi/Conjurer/radio_log.log'
|
||||
PERSISTENCE_PATH = '/home/pi/Conjurer/persistence.log'
|
||||
RADIOLOG_PATH = "/home/pi/Conjurer/radio_log.log"
|
||||
PERSISTENCE_PATH = "/home/pi/Conjurer/persistence.log"
|
||||
|
||||
else:
|
||||
LOGFILE = "/home/pi/Conjurer/discord_mus_service.log"
|
||||
@@ -41,13 +50,14 @@ if platform in ("linux", "linux2"):
|
||||
ENCODING = "utf-8"
|
||||
MUSIC_FOLDER = "/home/pi/RetroPie/mp3/"
|
||||
PRIORITY_FOLDER = "/home/pi/RetroPie/mp3/Magiczne i chuj/"
|
||||
RADIOLOG_PATH = '/home/pi/Conjurer/radio_log.log'
|
||||
PERSISTENCE_PATH = '/home/pi/Conjurer/persistence.log'
|
||||
|
||||
RADIOLOG_PATH = "/home/pi/Conjurer/radio_log.log"
|
||||
PERSISTENCE_PATH = "/home/pi/Conjurer/persistence.log"
|
||||
|
||||
random.seed()
|
||||
music_file_list = []
|
||||
priority_list = []
|
||||
|
||||
|
||||
def rescan():
|
||||
"""
|
||||
The `rescan` function logs a message, scans for mp3 files in a specified folder,
|
||||
@@ -69,8 +79,8 @@ def rescan():
|
||||
priority_list.append(temp_music_file)
|
||||
|
||||
with open(
|
||||
"/home/pi/Conjurer/all_playlist.playlist", "w", encoding="utf-8"
|
||||
) as w_file:
|
||||
"/home/pi/Conjurer/all_playlist.playlist", "w", encoding="utf-8"
|
||||
) as w_file:
|
||||
try:
|
||||
for item in music_file_list:
|
||||
w_file.write(item)
|
||||
@@ -100,11 +110,11 @@ def thread_rescan():
|
||||
|
||||
|
||||
def scan_tracks():
|
||||
#Set the filename and open the file
|
||||
# Set the filename and open the file
|
||||
logger = logging.getLogger("conjurer_musician")
|
||||
|
||||
file = open(RADIOLOG_PATH,'r')
|
||||
#Find the size of the file and move to the end
|
||||
file = open(RADIOLOG_PATH, "r")
|
||||
# Find the size of the file and move to the end
|
||||
st_results = os.stat(RADIOLOG_PATH)
|
||||
st_size = st_results[6]
|
||||
file.seek(st_size)
|
||||
@@ -121,14 +131,13 @@ def scan_tracks():
|
||||
st_results1 = os.stat(PERSISTENCE_PATH)
|
||||
st_size1 = st_results1[6]
|
||||
time.sleep(0.1)
|
||||
file1 = open(PERSISTENCE_PATH, 'r')
|
||||
file1 = open(PERSISTENCE_PATH, "r")
|
||||
lines = file1.readlines()
|
||||
result = ["next", lines[2]]
|
||||
file1.close()
|
||||
returned = requests.post(
|
||||
f"{MAIN_BOT_ADDRESS}{MUSIC_TRACKER}",
|
||||
json=result,
|
||||
timeout=360)
|
||||
f"{MAIN_BOT_ADDRESS}{MUSIC_TRACKER}", json=result, timeout=360
|
||||
)
|
||||
logger.info("SENT")
|
||||
logger.info(returned.status_code)
|
||||
logger.info("SEND CONFIRMED")
|
||||
@@ -139,33 +148,32 @@ def scan_tracks():
|
||||
time.sleep(1)
|
||||
file.seek(where)
|
||||
else:
|
||||
if re.match(".*Prepared.*",line):
|
||||
if re.match(".*Prepared.*", line):
|
||||
result = None
|
||||
if re.match(".*jingles.*", line):
|
||||
logger.info("jingles")
|
||||
logger.info(line) # already has newline
|
||||
logger.info(line) # already has newline
|
||||
result = ["jingles", line]
|
||||
elif re.match(".*priority.*", line):
|
||||
logger.info("priority")
|
||||
logger.info(line) # already has newline
|
||||
logger.info(line) # already has newline
|
||||
result = ["priority", line]
|
||||
elif re.match(".*hit.*", line):
|
||||
logger.info("hit")
|
||||
logger.info(line) # already has newline
|
||||
logger.info(line) # already has newline
|
||||
result = ["hit", line]
|
||||
elif re.match(".*all_playlist.*", line):
|
||||
logger.info("all")
|
||||
logger.info(line) # already has newline
|
||||
logger.info(line) # already has newline
|
||||
result = ["all", line]
|
||||
elif re.match(".*request.*", line):
|
||||
logger.info("requests")
|
||||
logger.info(line) # already has newline
|
||||
logger.info(line) # already has newline
|
||||
result = ["requests", line]
|
||||
if result:
|
||||
returned = requests.post(
|
||||
f"{MAIN_BOT_ADDRESS}{MUSIC_TRACKER}",
|
||||
json=result,
|
||||
timeout=360)
|
||||
f"{MAIN_BOT_ADDRESS}{MUSIC_TRACKER}", json=result, timeout=360
|
||||
)
|
||||
logger.info("SENT")
|
||||
logger.info(returned.status_code)
|
||||
logger.info("SEND CONFIRMED")
|
||||
@@ -330,9 +338,10 @@ def stream_music():
|
||||
:return: A JSON response containing a key "music_file_list" with the value of the variable `music_file_list`.
|
||||
"""
|
||||
|
||||
#return send_from_directory("/tmp/hls", "stream.m3u8")
|
||||
# return send_from_directory("/tmp/hls", "stream.m3u8")
|
||||
return render_template("/home/pi/Conjurer/stream.html")
|
||||
|
||||
|
||||
@app.route("/<string:file_name>")
|
||||
def stream(file_name):
|
||||
"""
|
||||
@@ -348,6 +357,7 @@ def stream(file_name):
|
||||
video_dir = "/tmp/hls"
|
||||
return send_from_directory(video_dir, file_name)
|
||||
|
||||
|
||||
@app.route("/stream_mp3", methods=["GET"])
|
||||
def stream_music_mp3():
|
||||
"""
|
||||
@@ -367,8 +377,10 @@ def clear_pr_pls():
|
||||
:return: A JSON response indicating the success of the operation.
|
||||
"""
|
||||
app.logger.info("CLEARING PLAYLIST")
|
||||
with open('/home/pi/Conjurer/priority_queue.playlist', 'w', encoding='utf-8') as cleared_pl:
|
||||
cleared_pl.write('')
|
||||
with open(
|
||||
"/home/pi/Conjurer/priority_queue.playlist", "w", encoding="utf-8"
|
||||
) as cleared_pl:
|
||||
cleared_pl.write("")
|
||||
|
||||
return_data = jsonify(isError=False, message="Success", statusCode=200, data=[])
|
||||
return return_data, 200
|
||||
@@ -438,21 +450,20 @@ def add_request():
|
||||
app.logger.info(record)
|
||||
app.logger.info(record["lista_slow"])
|
||||
app.logger.info(record["UUID"])
|
||||
return_data = wyszukaj(
|
||||
record["lista_slow"], 0, app.logger, False
|
||||
)
|
||||
return_data = wyszukaj(record["lista_slow"], 0, app.logger, False)
|
||||
|
||||
with open(
|
||||
"/home/pi/Conjurer/request.playlist", "a", encoding="utf-8"
|
||||
) as s_file:
|
||||
with open("/home/pi/Conjurer/request.playlist", "a", encoding="utf-8") as s_file:
|
||||
for item in return_data:
|
||||
s_file.write(item[1] + "\n")
|
||||
return_data = (
|
||||
jsonify(isError=False, message="Success", statusCode=200, data={"status": "OK"}),
|
||||
jsonify(
|
||||
isError=False, message="Success", statusCode=200, data={"status": "OK"}
|
||||
),
|
||||
200,
|
||||
)
|
||||
return return_data
|
||||
|
||||
|
||||
@app.route("/create_priority_playlist", methods=["POST"])
|
||||
def create_priority_playlist():
|
||||
"""
|
||||
@@ -474,13 +485,14 @@ def create_priority_playlist():
|
||||
return_data = wyszukaj(
|
||||
record["lista_slow"], record["dlugosc_plejlisty"], app.logger, False
|
||||
)
|
||||
with open(
|
||||
"/home/pi/Conjurer/request.playlist", "a", encoding="utf-8"
|
||||
) as s_file:
|
||||
return_data = random.shuffle(return_data)
|
||||
with open("/home/pi/Conjurer/request.playlist", "a", encoding="utf-8") as s_file:
|
||||
for item in return_data:
|
||||
s_file.write(item[1] + "\n")
|
||||
return_data = (
|
||||
jsonify(isError=False, message="Success", statusCode=200, data={"status": "OK"}),
|
||||
jsonify(
|
||||
isError=False, message="Success", statusCode=200, data={"status": "OK"}
|
||||
),
|
||||
200,
|
||||
)
|
||||
return return_data
|
||||
@@ -513,7 +525,9 @@ def add_to_priority():
|
||||
for item in return_data:
|
||||
s_file.write(item[1] + "\n")
|
||||
return_data = (
|
||||
jsonify(isError=False, message="Success", statusCode=200, data={"status": "OK"}),
|
||||
jsonify(
|
||||
isError=False, message="Success", statusCode=200, data={"status": "OK"}
|
||||
),
|
||||
200,
|
||||
)
|
||||
return return_data
|
||||
|
||||
@@ -56,7 +56,7 @@ s = crossfade(fade_out=2., fade_in=2., duration=4., fallback(id="switcher", trac
|
||||
|
||||
# Set up an interactive harbor for controlling the stream
|
||||
interactive.harbor(port = 9999)
|
||||
|
||||
#harbor.input(buffer=30.0)
|
||||
# Set up interactive controls for bass boost
|
||||
f = interactive.float("f", description="Frequency", min=0., max=1000., unit="Hz", 200.)
|
||||
g = interactive.float("g", description="Gain", min=0., max=20., unit="dB", 8.)
|
||||
@@ -67,15 +67,17 @@ s = add([s, b])
|
||||
a = interactive.float("main_volume", min=0., max=20., 0.4)
|
||||
s = compress.multiband.interactive(bands=7, s)
|
||||
|
||||
mic_gain = interactive.float("mic_volume", min=0., max=20., 6.)
|
||||
mic_gain = interactive.float("mic_volume", min=0., max=120., 6.)
|
||||
|
||||
# Apply audio processing effects
|
||||
tmic = buffer(input.pulseaudio()) # Microphone
|
||||
mic = amplify(mic_gain, tmic)
|
||||
mic = gate(threshold=-80., range=-120., mic)
|
||||
mic = compress(threshold=0., ratio=2.,mic)
|
||||
mic = blank.strip(max_blank=10., min_noise=.1, threshold=-20., mic)
|
||||
mic = nrj(normalize(mic))
|
||||
mic = blank.strip(max_blank=15., min_noise=.1, threshold=-30., mic)
|
||||
mic = fallback(id="switcher2", track_sensitive=false, [mic, blank()])
|
||||
|
||||
s = add([s, mic])
|
||||
# Apply audio processing effects
|
||||
s = nrj(normalize(s))
|
||||
s = amplify(a, s)
|
||||
@@ -83,8 +85,12 @@ s = amplify(a, s)
|
||||
s = blank.skip(max_blank=10., s)
|
||||
|
||||
#Manual audition override
|
||||
source_control = interactive.bool("Source control", true)
|
||||
s = switch(track_sensitive=false, [(source_control,mic),({true},s)])
|
||||
live_enabled = interactive.bool("Going Live!", true)
|
||||
|
||||
s = add([mic,s])
|
||||
s=switch(track_sensitive=false,
|
||||
[(live_enabled, mic),
|
||||
({true}, s)])
|
||||
|
||||
# Configure logging settings
|
||||
log_to_stdout = true
|
||||
@@ -101,6 +107,7 @@ set("log.file.path", logpath)
|
||||
# Set up emergency fallback track
|
||||
emergency = single("/home/pi/RetroPie/mp3/Youtube/Dr. Peacock - Trip to Ireland [GvrvQTUbUcA].mp3")
|
||||
radio = fallback(id="switcher2", track_sensitive=false, [s, emergency])
|
||||
|
||||
# Set up an interactive control for skipping tracks
|
||||
p = interactive.bool("Skip track", false)
|
||||
def http_skip(~protocol, ~data, ~headers, uri)=
|
||||
@@ -132,6 +139,7 @@ interactive.persistent("script.params")
|
||||
|
||||
# Configure output formats and destinations
|
||||
|
||||
|
||||
output.icecast(%mp3, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream", radio)
|
||||
output.pulseaudio(radio)
|
||||
#output.file.hls("/tmp/hls", [("mp3-low", %mp3(bitrate=96)), ("mp3-hi", %mp3(bitrate=160))], radio)
|
||||
|
||||
@@ -598,6 +598,98 @@ class MusicModule(commands.Cog):
|
||||
return
|
||||
self.logger.info("Connected to voice")
|
||||
|
||||
@commands.hybrid_command(
|
||||
name="batch_download",
|
||||
description="Zaciąga obiekty z pliku",
|
||||
guild=discord.Object(id=664789470779932693),
|
||||
)
|
||||
async def batch_download(self, ctx):
|
||||
content_type = ctx.message.attachments[0].content_type
|
||||
check = re.search ("text\/plain; *charset=(.*)", content_type, re.IGNORECASE)
|
||||
await ctx.reply("Kurwa. Aleś mi roboty narobił... No nic. Ku radości. Skal!")
|
||||
async with ctx.typing():
|
||||
if check:
|
||||
global MUZYKA # pylint: disable=global-variable-not-assigned
|
||||
file_bytes = await ctx.message.attachments[0].read()
|
||||
text = file_bytes.decode(encoding=check.group(1))
|
||||
self.logger.info(text)
|
||||
lines = text.split("\n")
|
||||
for link in lines:
|
||||
link = link.strip()
|
||||
self.logger.info(link)
|
||||
pat = r"^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$"
|
||||
self.logger.info("Verification")
|
||||
if re.match(pat, link) and (re.match(".*youtube.*", link) or re.match(".*youtu.be.*", link)):
|
||||
self.logger.info("%s to link do jutuba", link)
|
||||
dir_path, files = await music_functions.get_file(
|
||||
ctx, "Youtube", link
|
||||
)
|
||||
if files:
|
||||
for file_iter in files:
|
||||
global MUZYKA # pylint: disable=global-variable-not-assigned
|
||||
MUZYKA["queue"].insert(0, file_iter)
|
||||
music_functions.MUSIC_FILE_LIST.update_file_list(file_iter)
|
||||
MUZYKA["requester"].insert(0, ctx.author)
|
||||
await ctx.send(f"Dodałem do listy {file_iter}")
|
||||
self.logger.info("Jutub udany")
|
||||
|
||||
elif re.match(pat, link) and re.match(".*spotify.*", link):
|
||||
self.logger.info("%s to link do spotify", link)
|
||||
dir_path, files = await music_functions.get_file(
|
||||
ctx, "Spotify", link
|
||||
)
|
||||
if platform == "win32":
|
||||
separator = "\\"
|
||||
else:
|
||||
separator = "/"
|
||||
for file in files:
|
||||
file_path = (
|
||||
dir_path
|
||||
+ separator
|
||||
+ file["artist"]
|
||||
+ " - "
|
||||
+ file["name"]
|
||||
+ ".mp3"
|
||||
)
|
||||
|
||||
MUZYKA["queue"].insert(
|
||||
0,
|
||||
dir_path
|
||||
+ separator
|
||||
+ file["artist"]
|
||||
+ " - "
|
||||
+ file["name"]
|
||||
+ ".mp3",
|
||||
)
|
||||
MUZYKA["requester"].insert(0, ctx.author)
|
||||
music_functions.MUSIC_FILE_LIST.update_file_list(file_path)
|
||||
await ctx.send(
|
||||
f"Dodałem do listy {dir_path}{file['artist']} - + {file['name']}.mp3"
|
||||
)
|
||||
self.logger.info("Spotifaj udany")
|
||||
|
||||
|
||||
elif re.match(pat, link):
|
||||
self.logger.info("%s to link do czegos", link)
|
||||
sciezka,files = await music_functions.get_file(
|
||||
ctx, "Pornol", link
|
||||
)
|
||||
if files:
|
||||
self.logger.info("Pornol udany")
|
||||
await ctx.send(
|
||||
f"Jest w tajnym archiwum pod adresem{sciezka})"
|
||||
)
|
||||
|
||||
else:
|
||||
self.logger.info("Spierdalaj")
|
||||
self.logger.info(link)
|
||||
await ctx.message.reply("Spierdalaj")
|
||||
else:
|
||||
self.logger.info(content_type)
|
||||
self.logger.info("Spierdalaj")
|
||||
await ctx.message.reply("Spierdalaj")
|
||||
|
||||
|
||||
async def disconnect(self, ctx):
|
||||
"""
|
||||
Asynchronous Python function that disconnects the voice client if it is connected and
|
||||
|
||||
+2
-1
@@ -150,9 +150,10 @@ async def get_file(ctx, source, link):
|
||||
elif source == "Youtube":
|
||||
link_ok = False
|
||||
pat = r"^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$"
|
||||
if re.match(pat, link) and re.match(".*youtube.*", link):
|
||||
if re.match(pat, link) and (re.match(".*youtube.*", link) or re.match(".*youtu.be.*", link)):
|
||||
link_ok = True
|
||||
|
||||
|
||||
if link_ok:
|
||||
dir_path = ""
|
||||
file_list = []
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/Hallman/Hallman - 7 Bram/Niezłomność/Twardzi jak Stal/03-Forteca-1942.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/09. Świty Zmartwychwstania.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/Horytnica Czas Patriotów/Horytnica - Promo track CD 2011 Nie musimy umiera.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/08-Schmaletz-REWOLUCYJNA_NSZ(1).mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/schmaletz_-_nie_ma_fajnych_lasek_na_prawicy.mp3
|
||||
/home/pi/RetroPie/mp3/Youtube/ADU - Lecimy ze Smoleńska z powrotem [f3CVfG4pV8M].mp3
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Anahata - Winged Hussars - Cover.m4a
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - 40#1 - Live, at Woodstock Festival.m4a
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - Uprising - Live, at Woodstock Festival.m4a
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - Inmate 4859.m4a
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - Winged Hussars.m4a
|
||||
/home/pi/RetroPie/mp3/Youtube/ADU Ada Karczmarczyk - Hej husarzu! ⧸ NIE_PODLE_głości dzień [SReTynvd6ek].mp3
|
||||
/home/pi/RetroPie/mp3/2023 Aug-Oct/Sabadu - A Very Polish Christmas.mp3
|
||||
/home/pi/RetroPie/mp3/2023 Aug-Oct/Sabadu - Mighty Polish Tank.mp3
|
||||
/home/pi/RetroPie/mp3/Youtube/ADU - Nie chcę w lewo, nie chcę w prawo [J3Ok-KcbQ80].mp3
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - 40#1 - World War Tour 2010.m4a
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/01. Prolog.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/02. Honor Legionisty.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/07. Już Nie Musimy Umierać.mp3
|
||||
@@ -0,0 +1,46 @@
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - 40#1 - World War Tour 2010.m4a
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/08-Schmaletz-REWOLUCYJNA_NSZ(1).mp3
|
||||
/home/pi/RetroPie/mp3/Youtube/ADU feat MATEJKO - Nie strzelam do zdrajców oczami [PGL6Q9G4_JM].mp3
|
||||
/home/pi/RetroPie/mp3/Youtube/ADU - Lecimy ze Smoleńska z powrotem [f3CVfG4pV8M].mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/Horytnica Czas Patriotów/Horytnica - Promo track CD 2011 Nie musimy umiera.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/01. Prolog.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/02. Honor Legionisty.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/03. Kraj Zdradzony.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/04. Mały Powstaniec.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/05. Lisowczycy.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/06. Śląski Rycerz.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/07. Już Nie Musimy Umierać.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/08. Sierp I Młot.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/09. Świty Zmartwychwstania.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/10. Katyńskie Łzy.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/11. Kochana Ma Polska.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/12. Słowiańska Armia Pracy.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/13. Pamięć I Duma.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2012/Głos Patriotów (2011) (Wirrrus)/14. Epilog.mp3
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Anahata - Winged Hussars - Cover.m4a
|
||||
/home/pi/RetroPie/mp3/Youtube/ADU - Nie chcę w lewo, nie chcę w prawo [J3Ok-KcbQ80].mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/Hallman/Hallman - 7 Bram/Niezłomność/Twardzi jak Stal/03-Forteca-1942.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/Forteca - Bagnet na broń.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/02-2 Forteca.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2013/SABATON-Metalus Hammerus Rex (djdariush)/40-1.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2014/Sabaton - Heroes (Deluxe Earbook Edition) 2014/CD1/04. Inmate 4859_[plixid.com].mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - 1942.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - Apel poległych.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - BEZIMIEŃCOM.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - DZIŚ IDE WALCZYĆ MAMO.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - GNIEW.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - KATYŃ.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2010/Sabaton -2010- Coat Of Arms/03- Uprising.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - ORZEŁ BIAŁY.mp3
|
||||
/home/pi/RetroPie/mp3/2023 Aug-Oct/Sabadu - Mighty Polish Tank.mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/Dj. Celownik & Hallmann - O jau mano mielas [zapiska.pl].mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/Dj.Celownik & Hallmann - Duma o Zakrzewskim [zapiska.pl].mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/Dj.Celownik & Hallmann - Na lipe slowianska [zapiska.pl].mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/Dj.Celownik & Hallmann - Piesn Legijonu Litewskiego [zapiska.pl].mp3
|
||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/08-Schmaletz-REWOLUCYJNA_NSZ(1).mp3
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - 40#1 - Live, at Woodstock Festival.m4a
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - Uprising - Live, at Woodstock Festival.m4a
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - Inmate 4859.m4a
|
||||
/home/pi/RetroPie/mp3/2022 Nov-Dec/Sabaton - Winged Hussars.m4a
|
||||
/home/pi/RetroPie/mp3/Youtube/ADU Ada Karczmarczyk - Hej husarzu! ⧸ NIE_PODLE_głości dzień [SReTynvd6ek].mp3
|
||||
/home/pi/RetroPie/mp3/2023 Aug-Oct/Sabadu - A Very Polish Christmas.mp3
|
||||
@@ -0,0 +1,4 @@
|
||||
let json.parse credentials = file.contents("/home/pi/Conjurer/icecast_credentials.json")
|
||||
|
||||
output.icecast(%mp3, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream",input.alsa(bufferize=false))
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
let json.parse credentials = file.contents("/home/pi/Conjurer/icecast_credentials.json")
|
||||
|
||||
mic = buffer(input.pulseaudio())
|
||||
emergency = blank()
|
||||
mic = blank.strip(max_blank=10., min_noise=0.2, threshold=-30., mic)
|
||||
|
||||
|
||||
radio = fallback(id="switcher2", track_sensitive=false, [mic, emergency])
|
||||
|
||||
output.icecast(%mp3, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream",radio)
|
||||
|
||||
@@ -67,6 +67,8 @@ async def on_ready():
|
||||
for com in client.commands:
|
||||
logger.info("Command %s is awejleble", com.qualified_name)
|
||||
|
||||
logger.info("Logged in as ---->", client.user)
|
||||
logger.info("ID:", client.user.id)
|
||||
|
||||
# TODO: ADMINISTRATION
|
||||
|
||||
|
||||
Reference in New Issue
Block a user