mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Tag: 1.17
Intermediate commits (oldest → newest): - attachment test - fx - Batch fix - work ongoing - cat got more sleep - Batch download - FX - fx - Batch hopefully - glbfx - last fix - Final fixes in radio - Merge branch 'main' of https://github.com/migatu/conjurer into main - Fixes - Happy Fucking Indepence Day Poland!!!
This commit is contained in:
+6
-5
@@ -16,6 +16,7 @@ from constants import (
|
||||
INITIAL_TIME_WAIT,
|
||||
MASTER_TIMEOUT,
|
||||
OPENAICLIENT,
|
||||
WORD_REACTIONS
|
||||
)
|
||||
|
||||
|
||||
@@ -85,13 +86,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:
|
||||
|
||||
@@ -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,7 +67,7 @@ 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)
|
||||
@@ -75,16 +75,22 @@ 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)
|
||||
|
||||
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)
|
||||
s = blank.skip(max_blank=10., s)192
|
||||
|
||||
#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 = switch(track_sensitive=false,
|
||||
[({!live_enabled}, live),
|
||||
({true}, radio)])
|
||||
|
||||
|
||||
def fading_transition(a,b)
|
||||
sequence([fade.out(a.source),fade.in(b.source)])
|
||||
end
|
||||
|
||||
# Configure logging settings
|
||||
log_to_stdout = true
|
||||
|
||||
@@ -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,51 @@
|
||||
/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 - 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 - 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/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/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 - 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,178 @@
|
||||
# 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)
|
||||
@@ -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,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.pulseaudio())
|
||||
|
||||
Reference in New Issue
Block a user