mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Tag: 1.11
Intermediate commits (oldest → newest): - NEw util - Audition - Fix - Fixed :) - Added more logging - Fix logging0
This commit is contained in:
@@ -206,6 +206,7 @@ def wyszukaj(word_list, how_many, _logger=None, return_to_bot=True):
|
||||
fun_logger.info("Wiele plików do zagrania")
|
||||
search_weight.sort(key=lambda x: x[0], reverse=True)
|
||||
return_list.extend(search_weight[: int(how_many)])
|
||||
fun_logger.info("Done: %s", return_list)
|
||||
return return_list
|
||||
|
||||
|
||||
@@ -369,6 +370,37 @@ def add_request():
|
||||
)
|
||||
return return_data
|
||||
|
||||
@app.route("/create_priority_playlist", methods=["POST"])
|
||||
def create_priority_playlist():
|
||||
"""
|
||||
The function `create_priority_playlist` receives a POST request with a JSON payload, logs the received
|
||||
item, adds it to a music file list, and returns a success message along with the updated record.
|
||||
|
||||
:return: A tuple containing a JSON response and a status code.
|
||||
The JSON response includes keys `isError`,
|
||||
`message`, `statusCode`, and `data`, with values
|
||||
indicating the success of the operation and the
|
||||
data that was received and added to the `music_file_list`.
|
||||
The status code returned is 200,indicating a successful response.
|
||||
"""
|
||||
record = json.loads(request.data)
|
||||
app.logger.info(record)
|
||||
app.logger.info(record["lista_slow"])
|
||||
app.logger.info(record["UUID"])
|
||||
app.logger.info(record["dlugosc_plejlisty"])
|
||||
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:
|
||||
for item in return_data:
|
||||
s_file.write(item[1] + "\n")
|
||||
return_data = (
|
||||
jsonify(isError=False, message="Success", statusCode=200, data={"status": "OK"}),
|
||||
200,
|
||||
)
|
||||
return return_data
|
||||
|
||||
|
||||
@app.route("/add_to_priority", methods=["POST"])
|
||||
|
||||
@@ -34,10 +34,9 @@ requests_queue = request.queue()
|
||||
|
||||
# Function to process the request queue and add new requests
|
||||
def queue_processing()
|
||||
f1=file.read("/home/pi/Conjurer/request.playlist")
|
||||
text = f1()
|
||||
if text != "" then
|
||||
requests_queue.push.uri(text)
|
||||
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()
|
||||
@@ -45,7 +44,7 @@ def queue_processing()
|
||||
end
|
||||
|
||||
# Randomly select a playlist with weights
|
||||
s4 = random(id="randomizer", weights=[1, 3, 5], [s1, s2, s3])
|
||||
s4 = random(id="randomizer", weights=[2, 3, 5], [s1, s2, s3])
|
||||
|
||||
# Load jingles playlist
|
||||
jingles = (playlist(reload_mode="watch", "/home/pi/Conjurer/jingles.playlist"))
|
||||
@@ -74,7 +73,7 @@ s = amplify(a, s)
|
||||
|
||||
mic = buffer(input.pulseaudio()) # Microphone
|
||||
mic = gate(threshold=-30., range=-80., mic)
|
||||
mic = blank.strip(max_blank=2., min_noise=.1, threshold=-20., mic)
|
||||
mic = blank.strip(max_blank=10., min_noise=.1, threshold=-20., mic)
|
||||
|
||||
s = add([s, mic])
|
||||
#w = interactive.float("wetness", min=0., max=1., 1.)
|
||||
@@ -82,7 +81,7 @@ s = add([s, mic])
|
||||
|
||||
|
||||
# Skip blank sections in the stream
|
||||
s = blank.skip(max_blank=2., s)
|
||||
s = blank.skip(max_blank=10., s)
|
||||
|
||||
# Configure logging settings
|
||||
log_to_stdout = true
|
||||
|
||||
Reference in New Issue
Block a user