mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-16 14:52:11 +00:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 64669887a3 | |||
| 6d3ce5d714 | |||
| e05f58624a | |||
| 651d796254 | |||
| b3e5a1aaf3 | |||
| 1f0e03590d | |||
| 0ad06cc69c | |||
| 6b5d312231 | |||
| 0674e1a1a8 | |||
| 61acd3f3f3 | |||
| 3ccc89f572 | |||
| 86f512cb34 | |||
| bf808eb634 | |||
| d3bd79b505 | |||
| 24247aa760 | |||
| 443d06280b | |||
| 1625149c64 | |||
| 93330638be | |||
| a830dfb18c |
+17
-7
@@ -9,7 +9,7 @@ import openai
|
|||||||
import requests
|
import requests
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from ai_functions import handle_response
|
from ai_functions import handle_response, hammer_assistant_create
|
||||||
from constants import (
|
from constants import (
|
||||||
DATA,
|
DATA,
|
||||||
GRAPHICS_PATH,
|
GRAPHICS_PATH,
|
||||||
@@ -25,11 +25,11 @@ class Events(commands.Cog):
|
|||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.logger = logging.getLogger("discord")
|
self.logger = logging.getLogger("discord")
|
||||||
|
|
||||||
@commands.Cog.listener()
|
async def cog_load(self):
|
||||||
async def on_ready(self):
|
self.logger.info("Starting personal assistants")
|
||||||
print("Ready!")
|
await hammer_assistant_create(self.bot)
|
||||||
print("Logged in as ---->", self.bot.user)
|
self.logger.info("Started personal assistants")
|
||||||
print("ID:", self.bot.user.id)
|
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_message(self, message):
|
async def on_message(self, message):
|
||||||
@@ -46,6 +46,7 @@ class Events(commands.Cog):
|
|||||||
channel = None
|
channel = None
|
||||||
if message.author == self.bot.user:
|
if message.author == self.bot.user:
|
||||||
return
|
return
|
||||||
|
|
||||||
if isinstance(message.author, discord.Member):
|
if isinstance(message.author, discord.Member):
|
||||||
for role in message.author.roles:
|
for role in message.author.roles:
|
||||||
if role.name == "Vykidailo":
|
if role.name == "Vykidailo":
|
||||||
@@ -67,7 +68,16 @@ class Events(commands.Cog):
|
|||||||
return
|
return
|
||||||
if isinstance(message.channel, discord.DMChannel):
|
if isinstance(message.channel, discord.DMChannel):
|
||||||
if message.author.id == 346956223645614080:
|
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
|
return
|
||||||
else:
|
else:
|
||||||
channel = self.bot.get_channel(1064888712565100614)
|
channel = self.bot.get_channel(1064888712565100614)
|
||||||
|
|||||||
+26
-1
@@ -17,7 +17,7 @@ from constants import (
|
|||||||
OPENAICLIENT,
|
OPENAICLIENT,
|
||||||
WORD_REACTIONS,
|
WORD_REACTIONS,
|
||||||
)
|
)
|
||||||
|
ASSISTANTS = {}
|
||||||
|
|
||||||
def num_tokens_from_string(message, model):
|
def num_tokens_from_string(message, model):
|
||||||
"""
|
"""
|
||||||
@@ -292,3 +292,28 @@ async def get_random_cyclic_message(client):
|
|||||||
)
|
)
|
||||||
logger.info(result)
|
logger.info(result)
|
||||||
return 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
|
||||||
|
|||||||
@@ -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
|
# Set up an interactive harbor for controlling the stream
|
||||||
interactive.harbor(port = 9999)
|
interactive.harbor(port = 9999)
|
||||||
harbor.input(buffer=30.0)
|
#harbor.input(buffer=30.0)
|
||||||
# Set up interactive controls for bass boost
|
# Set up interactive controls for bass boost
|
||||||
f = interactive.float("f", description="Frequency", min=0., max=1000., unit="Hz", 200.)
|
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.)
|
g = interactive.float("g", description="Gain", min=0., max=20., unit="dB", 8.)
|
||||||
@@ -68,29 +68,29 @@ a = interactive.float("main_volume", min=0., max=20., 0.4)
|
|||||||
s = compress.multiband.interactive(bands=7, s)
|
s = compress.multiband.interactive(bands=7, s)
|
||||||
|
|
||||||
mic_gain = interactive.float("mic_volume", min=0., max=120., 6.)
|
mic_gain = interactive.float("mic_volume", min=0., max=120., 6.)
|
||||||
|
|
||||||
# Apply audio processing effects
|
# Apply audio processing effects
|
||||||
tmic = buffer(input.pulseaudio()) # Microphone
|
tmic = buffer(input.pulseaudio()) # Microphone
|
||||||
mic = amplify(mic_gain, tmic)
|
mic = amplify(mic_gain, tmic)
|
||||||
mic = gate(threshold=-80., range=-120., mic)
|
mic = gate(threshold=-80., range=-120., mic)
|
||||||
mic = compress(threshold=0., ratio=2.,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()])
|
||||||
|
|
||||||
# Apply audio processing effects
|
# Apply audio processing effects
|
||||||
s = nrj(normalize(s))
|
s = nrj(normalize(s))
|
||||||
s = amplify(a, s)
|
s = amplify(a, s)
|
||||||
# Skip blank sections in the stream
|
# Skip blank sections in the stream
|
||||||
s = blank.skip(max_blank=10., s)192
|
s = blank.skip(max_blank=10., s)
|
||||||
|
|
||||||
#Manual audition override
|
#Manual audition override
|
||||||
live_enabled = interactive.bool("Going Live!", true)
|
live_enabled = interactive.bool("Going Live!", true)
|
||||||
s = switch(track_sensitive=false,
|
|
||||||
[({!live_enabled}, live),
|
|
||||||
({true}, radio)])
|
|
||||||
|
|
||||||
|
s = add([mic,s])
|
||||||
def fading_transition(a,b)
|
s=switch(track_sensitive=false,
|
||||||
sequence([fade.out(a.source),fade.in(b.source)])
|
[(live_enabled, mic),
|
||||||
end
|
({true}, s)])
|
||||||
|
|
||||||
# Configure logging settings
|
# Configure logging settings
|
||||||
log_to_stdout = true
|
log_to_stdout = true
|
||||||
@@ -107,6 +107,7 @@ set("log.file.path", logpath)
|
|||||||
# Set up emergency fallback track
|
# Set up emergency fallback track
|
||||||
emergency = single("/home/pi/RetroPie/mp3/Youtube/Dr. Peacock - Trip to Ireland [GvrvQTUbUcA].mp3")
|
emergency = single("/home/pi/RetroPie/mp3/Youtube/Dr. Peacock - Trip to Ireland [GvrvQTUbUcA].mp3")
|
||||||
radio = fallback(id="switcher2", track_sensitive=false, [s, emergency])
|
radio = fallback(id="switcher2", track_sensitive=false, [s, emergency])
|
||||||
|
|
||||||
# Set up an interactive control for skipping tracks
|
# Set up an interactive control for skipping tracks
|
||||||
p = interactive.bool("Skip track", false)
|
p = interactive.bool("Skip track", false)
|
||||||
def http_skip(~protocol, ~data, ~headers, uri)=
|
def http_skip(~protocol, ~data, ~headers, uri)=
|
||||||
@@ -138,6 +139,7 @@ interactive.persistent("script.params")
|
|||||||
|
|
||||||
# Configure output formats and destinations
|
# Configure output formats and destinations
|
||||||
|
|
||||||
|
|
||||||
output.icecast(%mp3, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream", radio)
|
output.icecast(%mp3, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream", radio)
|
||||||
output.pulseaudio(radio)
|
output.pulseaudio(radio)
|
||||||
#output.file.hls("/tmp/hls", [("mp3-low", %mp3(bitrate=96)), ("mp3-hi", %mp3(bitrate=160))], radio)
|
#output.file.hls("/tmp/hls", [("mp3-low", %mp3(bitrate=96)), ("mp3-hi", %mp3(bitrate=160))], radio)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -28,17 +28,12 @@
|
|||||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - Apel poległych.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 - 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 - DZIŚ IDE WALCZYĆ MAMO.mp3
|
||||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - Elegia o Chłopcu polskim.mp3
|
|
||||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - GNIEW.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/2011/muza patriotyczna/FORTECA - KATYŃ.mp3
|
||||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/Forteca - Miałeś tylko karabin.mp3
|
|
||||||
/home/pi/RetroPie/mp3/Muzyka/2010/Sabaton -2010- Coat Of Arms/03- Uprising.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/Muzyka/2011/muza patriotyczna/FORTECA - ORZEŁ BIAŁY.mp3
|
||||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - SŁOŃCE WRZEŚNIA.mp3
|
|
||||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/FORTECA - Żołnierz Polski.mp3
|
|
||||||
/home/pi/RetroPie/mp3/2023 Aug-Oct/Sabadu - Mighty Polish Tank.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 - O jau mano mielas [zapiska.pl].mp3
|
||||||
/home/pi/RetroPie/mp3/Muzyka/2011/muza patriotyczna/Dj.Celownik
|
|
||||||
/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 - 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 - 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/Dj.Celownik & Hallmann - Piesn Legijonu Litewskiego [zapiska.pl].mp3
|
||||||
|
|||||||
@@ -1,178 +0,0 @@
|
|||||||
# FILEPATH: /home/mtuszowski/conjurer/conjurer_musician/radio_conjurer.liq
|
|
||||||
|
|
||||||
# This script sets up a Liquidsoap radio stream with various features and configurations.
|
|
||||||
|
|
||||||
# Load icecast credentials from a JSON file
|
|
||||||
let json.parse credentials = file.contents("/home/pi/Conjurer/icecast_credentials.json")
|
|
||||||
|
|
||||||
# Enable replaygain metadata processing
|
|
||||||
enable_replaygain_metadata()
|
|
||||||
|
|
||||||
# Set up a playlog for tracking played tracks
|
|
||||||
|
|
||||||
l = playlog(duration = 72000.0, persistency="/home/pi/Conjurer/persistence.log")
|
|
||||||
|
|
||||||
# Function to check if a track can be played based on its metadata
|
|
||||||
def check(r)
|
|
||||||
m = request.metadata(r)
|
|
||||||
if l.last(m) < 36000. then
|
|
||||||
log.info("Rejecting #{m['filename']} (played #{l.last(m)}s ago).")
|
|
||||||
false
|
|
||||||
else
|
|
||||||
l.add(m)
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Define playlists to be used in the stream
|
|
||||||
s1 = replaygain(playlist(reload_mode="watch", check_next=check, "/home/pi/Conjurer/all_playlist.playlist"))
|
|
||||||
s2 = replaygain(playlist(reload_mode="watch", check_next=check, "/home/pi/Conjurer/priority_queue.playlist"))
|
|
||||||
s3 = replaygain(playlist(reload_mode="watch", check_next=check, "/home/pi/Conjurer/hit.playlist"))
|
|
||||||
|
|
||||||
# Create a request queue for user-generated requests
|
|
||||||
requests_queue = request.queue()
|
|
||||||
|
|
||||||
# Function to process the request queue and add new requests
|
|
||||||
def queue_processing()
|
|
||||||
text=file.lines("/home/pi/Conjurer/request.playlist")
|
|
||||||
if text != [] then
|
|
||||||
list.iter(fun(item) -> requests_queue.push.uri(item), text)
|
|
||||||
file.remove("/home/pi/Conjurer/request.playlist")
|
|
||||||
f = file.open("/home/pi/Conjurer/request.playlist", create=true)
|
|
||||||
f.close()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Randomly select a playlist with weights
|
|
||||||
s4 = random(id="randomizer", weights=[2, 3, 5], [s1, s2, s3])
|
|
||||||
|
|
||||||
# Load jingles playlist
|
|
||||||
jingles = (playlist(reload_mode="watch", "/home/pi/Conjurer/jingles.playlist"))
|
|
||||||
|
|
||||||
# Create the main stream with random playlist and jingles
|
|
||||||
s = rotate(id="randomizer", weights=[10, 1], [s4, jingles])
|
|
||||||
|
|
||||||
s = crossfade(fade_out=2., fade_in=2., duration=4., fallback(id="switcher", track_sensitive=false, [requests_queue, s]))
|
|
||||||
|
|
||||||
# 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.)
|
|
||||||
b = bass_boost(frequency=f, gain=g, s)
|
|
||||||
s = add([s, b])
|
|
||||||
|
|
||||||
# Set up interactive control for main volume
|
|
||||||
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=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 = nrj(normalize(mic))
|
|
||||||
mic = blank.strip(max_blank=10., min_noise=.1, threshold=-20., mic)
|
|
||||||
s = add([s, mic])
|
|
||||||
|
|
||||||
# Apply audio processing effects
|
|
||||||
s = nrj(normalize(s))
|
|
||||||
s = amplify(a, s)
|
|
||||||
# Skip blank sections in the stream
|
|
||||||
s = blank.skip(max_blank=10., s)
|
|
||||||
|
|
||||||
#Manual audition override
|
|
||||||
live_enabled = interactive.bool("Going Live!", true)
|
|
||||||
|
|
||||||
|
|
||||||
s = crossfade(fade_out=10., fade_in=5., duration=15., switch(track_sensitive=false,
|
|
||||||
[(live_enabled, mic),
|
|
||||||
({true}, s)])
|
|
||||||
)
|
|
||||||
|
|
||||||
# Configure logging settings
|
|
||||||
log_to_stdout = true
|
|
||||||
log_to_file = true
|
|
||||||
logpath = "/home/pi/Conjurer/radio_log.log"
|
|
||||||
loglevel = 3
|
|
||||||
set("log.stdout", log_to_stdout)
|
|
||||||
set("log.level", loglevel)
|
|
||||||
|
|
||||||
# Enable logging to file
|
|
||||||
set("log.file", log_to_file)
|
|
||||||
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)=
|
|
||||||
radio.skip()
|
|
||||||
http.response(code=200,data="Skipped")
|
|
||||||
end
|
|
||||||
harbor.http.register(port=54321,method="GET","/skip", http_skip)
|
|
||||||
|
|
||||||
|
|
||||||
# Function to process the request queue and skip the current track if requested
|
|
||||||
def check_skip()
|
|
||||||
if p() then
|
|
||||||
log.info("Skipping current track.")
|
|
||||||
radio.skip()
|
|
||||||
p.set(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Run the queue processing function every 60 seconds
|
|
||||||
thread.run(every=60., queue_processing)
|
|
||||||
|
|
||||||
|
|
||||||
# Run the check_skip function every 5 seconds
|
|
||||||
thread.run(every=15., check_skip)
|
|
||||||
|
|
||||||
|
|
||||||
# Enable persistent script parameters
|
|
||||||
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)
|
|
||||||
# Uncomment the following lines to enable additional output formats
|
|
||||||
# output.icecast(%opus, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="opus-stream", radio)
|
|
||||||
# output.icecast(%ogg, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="ogg-stream", radio)
|
|
||||||
# output.icecast(%aac, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="aac-stream", radio)
|
|
||||||
# output.icecast(%flac, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="flac-stream", radio)
|
|
||||||
# output.icecast(%vorbis, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="vorbis-stream", radio)
|
|
||||||
# output.icecast(%speex, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="speex-stream", radio)
|
|
||||||
# output.icecast(%wav, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="wav-stream", radio)
|
|
||||||
# output.icecast(%pcm, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="pcm-stream", radio)
|
|
||||||
# output.icecast(%raw, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="raw-stream", radio)
|
|
||||||
# output.icecast(%s16l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s16l-stream", radio)
|
|
||||||
# output.icecast(%s16b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s16b-stream", radio)
|
|
||||||
# output.icecast(%s24l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s24l-stream", radio)
|
|
||||||
# output.icecast(%s24b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s24b-stream", radio)
|
|
||||||
# output.icecast(%s32l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s32l-stream", radio)
|
|
||||||
# output.icecast(%s32b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s32b-stream", radio)
|
|
||||||
# output.icecast(%s64l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s64l-stream", radio)
|
|
||||||
# output.icecast(%s64b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s64b-stream", radio)
|
|
||||||
# output.icecast(%s128l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s128l-stream", radio)
|
|
||||||
# output.icecast(%s128b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s128b-stream", radio)
|
|
||||||
# output.icecast(%s256l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s256l-stream", radio)
|
|
||||||
# output.icecast(%s256b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s256b-stream", radio)
|
|
||||||
# output.icecast(%s512l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s512l-stream", radio)
|
|
||||||
# output.icecast(%s512b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s512b-stream", radio)
|
|
||||||
# output.icecast(%s1024l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s1024l-stream", radio)
|
|
||||||
# output.icecast(%s1024b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s1024b-stream", radio)
|
|
||||||
# output.icecast(%s2048l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s2048l-stream", radio)
|
|
||||||
# output.icecast(%s2048b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s2048b-stream", radio)
|
|
||||||
# output.icecast(%s4096l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s4096l-stream", radio)
|
|
||||||
# output.icecast(%s4096b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s4096b-stream", radio)
|
|
||||||
# output.icecast(%s8192l, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s8192l-stream", radio)
|
|
||||||
# output.icecast(%s8192b, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="s8192b-stream", radio)
|
|
||||||
+8
-1
@@ -1,4 +1,11 @@
|
|||||||
let json.parse credentials = file.contents("/home/pi/Conjurer/icecast_credentials.json")
|
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.pulseaudio())
|
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:
|
for com in client.commands:
|
||||||
logger.info("Command %s is awejleble", com.qualified_name)
|
logger.info("Command %s is awejleble", com.qualified_name)
|
||||||
|
|
||||||
|
logger.info("Logged in as ---->", client.user)
|
||||||
|
logger.info("ID:", client.user.id)
|
||||||
|
|
||||||
# TODO: ADMINISTRATION
|
# TODO: ADMINISTRATION
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user